From 05c914156a572d2983b60863400267ccdfa6b100 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 18 Dec 2016 09:40:52 -0500 Subject: [PATCH] fixed session termination crash --- SAM.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SAM.cpp b/SAM.cpp index 84f8dbf6..1fc1227a 100644 --- a/SAM.cpp +++ b/SAM.cpp @@ -622,10 +622,16 @@ namespace client boost::asio::async_write (m_Socket, boost::asio::buffer (m_StreamBuffer, bytes_transferred), std::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), std::placeholders::_1)); // postpone termination else - Terminate (); + { + auto s = shared_from_this (); + m_Owner.GetService ().post ([s] { s->Terminate (); }); + } } else - Terminate (); + { + auto s = shared_from_this (); + m_Owner.GetService ().post ([s] { s->Terminate (); }); + } } else {