From 01110ad0baadfb43659ab54c3e0e9d58d8fb314b Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 28 Nov 2017 21:28:32 +0100 Subject: [PATCH] fix a crash when an async reply comes in but the transpost has vanished meanwhile --- libguh-core/jsonrpc/jsonrpcserver.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libguh-core/jsonrpc/jsonrpcserver.cpp b/libguh-core/jsonrpc/jsonrpcserver.cpp index 7ef1b5b8..24814487 100644 --- a/libguh-core/jsonrpc/jsonrpcserver.cpp +++ b/libguh-core/jsonrpc/jsonrpcserver.cpp @@ -531,6 +531,11 @@ void JsonRPCServer::asyncReplyFinished() { JsonReply *reply = qobject_cast(sender()); TransportInterface *interface = m_asyncReplies.take(reply); + if (!interface) { + qCWarning(dcJsonRpc()) << "Got an async reply but the requesting connection has vanished."; + reply->deleteLater(); + return; + } if (!reply->timedOut()) { Q_ASSERT_X(reply->handler()->validateReturns(reply->method(), reply->data()).first ,"validating return value", formatAssertion(reply->handler()->name(), reply->method(), reply->handler(), reply->data()).toLatin1().data());