From 76152088e93258cdd025f49902270a7c53757633 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 2 Jul 2014 09:53:22 +0200 Subject: [PATCH] Debugger: Fix race condition When getting debugger finished after a device disconnect it might re-enable the 'Start Debugging' button although debugging is not possible. Task-number: QTCREATORBUG-12585 Change-Id: I8901b440bb3e90e5f29cdeba2f6629d157c2e335 Reviewed-by: hjk --- src/plugins/debugger/debuggerplugin.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 3b8e2bc3661..ac39ec1cadd 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2322,12 +2322,15 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) m_hiddenStopAction->setAction(m_interruptAction); m_localsAndExpressionsWindow->setShowLocals(false); } else if (state == DebuggerFinished) { + ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); + Project *project = SessionManager::startupProject(); + const bool canRun = pe->canRun(project, DebugRunMode); // We don't want to do anything anymore. m_interruptAction->setEnabled(false); m_continueAction->setEnabled(false); m_exitAction->setEnabled(false); - m_startAction->setEnabled(true); - m_debugWithoutDeployAction->setEnabled(true); + m_startAction->setEnabled(canRun); + m_debugWithoutDeployAction->setEnabled(canRun); setProxyAction(m_visibleStartAction, Core::Id(Constants::DEBUG)); m_hiddenStopAction->setAction(m_undisturbableAction); m_codeModelSnapshot = CPlusPlus::Snapshot();