From 40b6413201ac5b6f53fd4508085f760585b0d742 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 4 Apr 2016 09:15:28 +0200 Subject: [PATCH] Debugger: Fix crash on close while debugging Task-number: QTCREATORBUG-15987 Change-Id: I510add216ec16c0c6622870f26c68c16e99769ed Reviewed-by: hjk --- src/plugins/debugger/debuggerplugin.cpp | 6 ++++++ src/plugins/debugger/debuggerruncontrol.cpp | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 654f9e2b014..3ac268c8b66 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2502,6 +2502,8 @@ void DebuggerPluginPrivate::setInitialState() void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) { + if (m_shuttingDown) + return; QTC_ASSERT(engine, return); QTC_ASSERT(m_watchersView->model(), return); QTC_ASSERT(m_returnView->model(), return); @@ -2647,6 +2649,8 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) void DebuggerPluginPrivate::updateDebugActions() { + if (m_shuttingDown) + return; //if we're currently debugging the actions are controlled by engine if (m_currentEngine->state() != DebuggerNotReady) return; @@ -2775,6 +2779,8 @@ QTreeView *inspectorView() void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int timeout) { + if (m_shuttingDown) + return; //qDebug() << "PLUGIN OUTPUT: " << channel << msg; QTC_ASSERT(m_logWindow, return); switch (channel) { diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 954539cd195..fab12a1920a 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -232,8 +232,11 @@ bool DebuggerRunControl::promptToStop(bool *optionalPrompt) const "Terminating the session in the current" " state can leave the target in an inconsistent state." " Would you still like to terminate it?"); - return showPromptToStopDialog(tr("Close Debugging Session"), question, - QString(), QString(), optionalPrompt); + bool result = showPromptToStopDialog(tr("Close Debugging Session"), question, + QString(), QString(), optionalPrompt); + if (result) + disconnect(this); + return result; } RunControl::StopResult DebuggerRunControl::stop()