minor fix to broadcast socket patch

This commit is contained in:
Arvid Norberg 2011-10-25 10:28:54 +00:00
parent 0a2b352795
commit da4998bd46
1 changed files with 7 additions and 1 deletions

View File

@ -392,7 +392,13 @@ namespace libtorrent
bool broadcast_socket::maybe_abort() bool broadcast_socket::maybe_abort()
{ {
if (m_abort && m_outstanding_operations == 0) if (m_abort && m_outstanding_operations == 0)
m_on_receive.clear(); {
// it's important that m_on_receive is cleared
// before the object is destructed, since it may
// hold a reference to ourself, which would otherwise
// cause an infinite recursion destructing the objects
receive_handler_t().swap(m_on_receive);
}
return m_abort; return m_abort;
} }