From f4dce0fe729dedf8138788a535e01fd8c6cde766 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 22 Aug 2016 16:35:16 +0200 Subject: [PATCH] Fix crash in JsonRpcConnection::MessageHandlerWrapper fixes #12506 --- lib/remote/httpserverconnection.cpp | 9 +-------- lib/remote/jsonrpcconnection.cpp | 6 +----- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp index acf5ccd1d..d3f75868b 100644 --- a/lib/remote/httpserverconnection.cpp +++ b/lib/remote/httpserverconnection.cpp @@ -83,11 +83,7 @@ void HttpServerConnection::Disconnect(void) m_CurrentRequest.~HttpRequest(); new (&m_CurrentRequest) HttpRequest(Stream::Ptr()); - { - Stream::Ptr stream = m_Stream; - m_Stream.reset(); - stream->Close(); - } + m_Stream->Close(); } bool HttpServerConnection::ProcessMessage(void) @@ -211,9 +207,6 @@ void HttpServerConnection::DataAvailableHandler(void) { bool close = false; - if (!m_Stream) - return; - if (!m_Stream->IsEof()) { boost::mutex::scoped_lock lock(m_DataHandlerMutex); diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index 54c393550..69321a63e 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -129,11 +129,7 @@ void JsonRpcConnection::Disconnect(void) Log(LogWarning, "JsonRpcConnection") << "API client disconnected for identity '" << m_Identity << "'"; - { - Stream::Ptr stream = m_Stream; - m_Stream.reset(); - stream->Close(); - } + m_Stream->Close(); if (m_Endpoint) m_Endpoint->RemoveClient(this);