From 63e807b0b4eb2a781f5800b508c74b1415aba87b Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 6 Feb 2020 10:53:45 -0500 Subject: [PATCH] fixed crash on stop --- libi2pd_client/SAM.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libi2pd_client/SAM.cpp b/libi2pd_client/SAM.cpp index bc4812bb..138e39cf 100644 --- a/libi2pd_client/SAM.cpp +++ b/libi2pd_client/SAM.cpp @@ -1042,9 +1042,12 @@ namespace client LogPrint (eLogError, "SAM: runtime exception: ", ex.what ()); } - for (auto& it: m_Sessions) - it.second->CloseStreams (); - m_Sessions.clear (); + { + std::unique_lock l(m_SessionsMutex); + for (auto& it: m_Sessions) + it.second->CloseStreams (); + m_Sessions.clear (); + } StopIOService (); }