diff --git a/src/plugins/projectexplorer/waitforstopdialog.cpp b/src/plugins/projectexplorer/waitforstopdialog.cpp index 0b825492dcf..a6ab2486cda 100644 --- a/src/plugins/projectexplorer/waitforstopdialog.cpp +++ b/src/plugins/projectexplorer/waitforstopdialog.cpp @@ -54,7 +54,7 @@ WaitForStopDialog::WaitForStopDialog(const QList updateProgressText(); for (const RunControl *rc : runControls) - connect(rc, &RunControl::stopped, this, &WaitForStopDialog::runControlFinished); + connect(rc, &RunControl::stopped, this, [this, rc] { runControlFinished(rc); }); m_timer.start(); } @@ -72,11 +72,9 @@ void WaitForStopDialog::updateProgressText() m_progressLabel->setText(text); } -void WaitForStopDialog::runControlFinished() +void WaitForStopDialog::runControlFinished(const RunControl *runControl) { - auto rc = qobject_cast(sender()); - m_runControls.removeOne(rc); - + m_runControls.removeOne(runControl); if (m_runControls.isEmpty()) { if (m_timer.elapsed() < 1000) QTimer::singleShot(1000 - m_timer.elapsed(), this, &QDialog::close); diff --git a/src/plugins/projectexplorer/waitforstopdialog.h b/src/plugins/projectexplorer/waitforstopdialog.h index 602b1812025..3d828d202a3 100644 --- a/src/plugins/projectexplorer/waitforstopdialog.h +++ b/src/plugins/projectexplorer/waitforstopdialog.h @@ -47,7 +47,7 @@ public: bool canceled(); private: void updateProgressText(); - void runControlFinished(); + void runControlFinished(const RunControl *runControl); QList m_runControls; QLabel *m_progressLabel;