From fba08f2552454f40bb5bb4c3a9edd88be381c9af Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Wed, 20 Mar 2013 19:23:54 +0100 Subject: [PATCH] consoleprocess_unix: handle race between disconnect and readyRead Ensure that we read before zeroing the pointer to the stubSocket and not after. Change-Id: If9d6f11916e644be96ed88db6a2595509f177233 Reviewed-by: Oswald Buddenhagen --- src/libs/utils/consoleprocess_unix.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index c6307d002f2..e6a2521720f 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -246,8 +246,11 @@ QString ConsoleProcess::stubServerListen() void ConsoleProcess::stubServerShutdown() { - if (d->m_stubSocket) + if (d->m_stubSocket) { + readStubOutput(); // we could get the shutdown signal before emptying the buffer + d->m_stubSocket->disconnect(); // avoid getting queued readyRead signals d->m_stubSocket->deleteLater(); // we might be called from the disconnected signal of m_stubSocket + } d->m_stubSocket = 0; if (d->m_stubServer.isListening()) { d->m_stubServer.close();