aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-06-11 14:07:28 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-06-28 10:34:34 +0100
commita04faf56dc000f51d87d3332e12aa380caef1fc8 (patch)
tree005877de5d40e839aa8031ef229efa4d102f7b14
parentMerge pull request #2111 (diff)
downloadmonero-a04faf56dc000f51d87d3332e12aa380caef1fc8.tar.xz
abstract_tcp_server2: guard against accessing lock on a destroyed object
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index 0fbd9ed28..61276e761 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -209,14 +209,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
bool connection<t_protocol_handler>::add_ref()
{
TRY_ENTRY();
- //_dbg3("[sock " << socket_.native_handle() << "] add_ref, m_peer_number=" << mI->m_peer_number);
- CRITICAL_REGION_LOCAL(m_self_refs_lock);
- //_dbg3("[sock " << socket_.native_handle() << "] add_ref 2, m_peer_number=" << mI->m_peer_number);
// Use safe_shared_from_this, because of this is public method and it can be called on the object being deleted
auto self = safe_shared_from_this();
if(!self)
return false;
+ //_dbg3("[sock " << socket_.native_handle() << "] add_ref, m_peer_number=" << mI->m_peer_number);
+ CRITICAL_REGION_LOCAL(self->m_self_refs_lock);
+ //_dbg3("[sock " << socket_.native_handle() << "] add_ref 2, m_peer_number=" << mI->m_peer_number);
if(m_was_shutdown)
return false;
m_self_refs.push_back(self);