From a6d28c9205f06c6afd0b0625973751ded3cd540c Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 20 Jul 2022 17:47:10 +0200 Subject: [PATCH] WaitForStopDialog: Avoid using sender() Change-Id: I559d8da00977f776c9d56cb63ea9ee6e72625de0 Reviewed-by: Eike Ziller --- src/plugins/projectexplorer/waitforstopdialog.cpp | 8 +++----- src/plugins/projectexplorer/waitforstopdialog.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) 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;