From 22773bd678519799a89462f7b28936f8a4ebf3ec Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 10 Oct 2014 16:48:42 -0400 Subject: [PATCH] fixed race condition --- Tunnel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tunnel.cpp b/Tunnel.cpp index 05aa5801..7a17b61e 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -300,13 +300,15 @@ namespace tunnel { if (pool) { + { + std::unique_lock l(m_PoolsMutex); + m_Pools.erase (pool->GetIdentHash ()); + } { std::unique_lock l(m_PendingTunnelsMutex); for (auto it: m_PendingTunnels) if (it.second->GetTunnelPool () == pool) it.second->SetTunnelPool (nullptr); } - std::unique_lock l(m_PoolsMutex); - m_Pools.erase (pool->GetIdentHash ()); delete pool; } }