From a99127d73bf55f5dbde375189e5af80c7329fa4e Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 5 Oct 2020 18:23:17 +0200 Subject: [PATCH] QMakeProjectManager: Do not ask to rebuild too often Due to the incomplete aspectification here, some of the connections are set up in createConfigWidget(). Config widgets are created and destroyed when the build configuration changes, and connections that did not directly depend on the widget or subwidgets accumulated. Use the the created widget as guard object to ensure connections live only as long as the widget. Task-number: QTCREATORBUG-24725 Change-Id: I4581f98e684ac92fd43ceba598d391c4dc8dbebe Reviewed-by: Christian Kandeler --- src/plugins/qmakeprojectmanager/qmakestep.cpp | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index 534bc27387e..62c3dffc119 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -81,6 +81,17 @@ QMakeStep::QMakeStep(BuildStepList *bsl, Utils::Id id) : AbstractProcessStep(bsl, id) { setLowPriority(); + + auto updateSummary = [this] { + BaseQtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit()); + if (!qtVersion) + return tr("qmake: No Qt version set. Cannot run qmake."); + const QString program = qtVersion->qmakeCommand().fileName(); + return tr("qmake: %1 %2").arg(program, project()->projectFilePath().fileName()); + }; + setSummaryUpdater(updateSummary); + + connect(target(), &Target::kitChanged, this, updateSummary); } QmakeBuildConfiguration *QMakeStep::qmakeBuildConfiguration() const @@ -540,15 +551,6 @@ BuildStepConfigWidget *QMakeStep::createConfigWidget() qmakeBuildConfigChanged(); - auto updateSummary = [this] { - BaseQtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit()); - if (!qtVersion) - return tr("qmake: No Qt version set. Cannot run qmake."); - const QString program = qtVersion->qmakeCommand().fileName(); - return tr("qmake: %1 %2").arg(program, project()->projectFilePath().fileName()); - }; - setSummaryUpdater(updateSummary); - updateSummary(); updateAbiWidgets(); updateEffectiveQMakeCall(); @@ -557,24 +559,27 @@ BuildStepConfigWidget *QMakeStep::createConfigWidget() this, &QMakeStep::qmakeArgumentsLineEdited); connect(buildConfigurationComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &QMakeStep::buildConfigurationSelected); + connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmlDebuggingChanged, - this, [this] { + widget, [this] { linkQmlDebuggingLibraryChanged(); askForRebuild(tr("QML Debugging")); }); + connect(project(), &Project::projectLanguagesUpdated, - this, &QMakeStep::linkQmlDebuggingLibraryChanged); + widget, [this] { linkQmlDebuggingLibraryChanged(); }); connect(target(), &Target::parsingFinished, - qmakeArgumentsEdit, [this]() { updateEffectiveQMakeCall(); }); + widget, [this] { updateEffectiveQMakeCall(); }); connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::useQtQuickCompilerChanged, - this, &QMakeStep::useQtQuickCompilerChanged); + widget, [this] { useQtQuickCompilerChanged(); }); connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::separateDebugInfoChanged, - this, &QMakeStep::separateDebugInfoChanged); + widget, [this] { separateDebugInfoChanged(); }); connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmakeBuildConfigurationChanged, - this, &QMakeStep::qmakeBuildConfigChanged); - connect(target(), &Target::kitChanged, this, &QMakeStep::qtVersionChanged); - connect(target(), &Target::kitChanged, this, updateSummary); - connect(abisListWidget, &QListWidget::itemChanged, this, [this]{ + widget, [this] { qmakeBuildConfigChanged(); }); + connect(target(), &Target::kitChanged, + widget, [this] { qtVersionChanged(); }); + + connect(abisListWidget, &QListWidget::itemChanged, this, [this] { abisChanged(); if (QmakeBuildConfiguration *bc = qmakeBuildConfiguration()) BuildManager::buildLists({bc->cleanSteps()});