diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 9cfc21d6a76..c27303b433a 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -373,10 +373,16 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker) } } - connect(runControl, &RunControl::stopped, this, [this, runControl] { + auto handleStop = [this, runControl]() { d->m_toolBusy = false; updateRunActions(); disconnect(d->m_stopAction, &QAction::triggered, runControl, &RunControl::initiateStop); + }; + + connect(runControl, &RunControl::stopped, this, handleStop); + connect(runControl, &RunControl::finished, this, [this, runControl, handleStop] { + if (d->m_toolBusy) + handleStop(); }); connect(d->m_stopAction, &QAction::triggered, runControl, &RunControl::initiateStop);