fix potential invalid access when shutting down broadcast socket

This commit is contained in:
Arvid Norberg 2011-11-19 22:17:13 +00:00
parent 413bc67279
commit 0bcdf7706c
1 changed files with 2 additions and 1 deletions

View File

@ -391,6 +391,7 @@ namespace libtorrent
bool broadcast_socket::maybe_abort() bool broadcast_socket::maybe_abort()
{ {
bool ret = m_abort;
if (m_abort && m_outstanding_operations == 0) if (m_abort && m_outstanding_operations == 0)
{ {
// it's important that m_on_receive is cleared // it's important that m_on_receive is cleared
@ -399,7 +400,7 @@ namespace libtorrent
// cause an infinite recursion destructing the objects // cause an infinite recursion destructing the objects
receive_handler_t().swap(m_on_receive); receive_handler_t().swap(m_on_receive);
} }
return m_abort; return ret;
} }
void broadcast_socket::close() void broadcast_socket::close()