diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index ec78fe1c758..2443e2eb382 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -101,7 +101,7 @@ QmlProfilerRunControl::QmlProfilerRunControl(RunConfiguration *runConfiguration, QmlProfilerRunControl::~QmlProfilerRunControl() { - if (d->m_profilerState) + if (d->m_running && d->m_profilerState) stop(); delete d; } diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index e4d04b86561..02410623ecb 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -333,12 +333,13 @@ AnalyzerRunControl *QmlProfilerTool::createRunControl(RunConfiguration *runConfi } auto runControl = new QmlProfilerRunControl(runConfiguration, this); - connect(runControl, &RunControl::finished, [this, runControl] { + connect(runControl, &RunControl::finished, this, [this, runControl] { d->m_toolBusy = false; updateRunActions(); + disconnect(d->m_stopAction, &QAction::triggered, runControl, &QmlProfilerRunControl::stop); }); - connect(d->m_stopAction, &QAction::triggered, runControl, [runControl] { runControl->stop(); }); + connect(d->m_stopAction, &QAction::triggered, runControl, &QmlProfilerRunControl::stop); updateRunActions(); return runControl;