diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 10ee8e75696..09facc0ed24 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -215,25 +215,18 @@ void CMakeManager::runCMakeWithProfiling(BuildSystem *buildSystem) if (ProjectExplorerPlugin::saveModifiedFiles()) { // cmakeBuildSystem->runCMakeWithProfiling() below will trigger Target::buildSystemUpdated // which will ensure that the "cmake-profile.json" has been created and we can load the viewer - std::unique_ptr context{new QObject}; - QObject *pcontext = context.get(); - QObject::connect(cmakeBuildSystem->target(), - &Target::buildSystemUpdated, - pcontext, - [context = std::move(context)]() mutable { - context.reset(); - Core::Command *ctfVisualiserLoadTrace = Core::ActionManager::command( - "Analyzer.Menu.StartAnalyzer.CtfVisualizer.LoadTrace"); + QObject::connect(cmakeBuildSystem->target(), &Target::buildSystemUpdated, this, [] { + Core::Command *ctfVisualiserLoadTrace = Core::ActionManager::command( + "Analyzer.Menu.StartAnalyzer.CtfVisualizer.LoadTrace"); - if (ctfVisualiserLoadTrace) { - auto *action = ctfVisualiserLoadTrace->actionForContext( - Core::Constants::C_GLOBAL); - const FilePath file = TemporaryDirectory::masterDirectoryFilePath() - / "cmake-profile.json"; - action->setData(file.nativePath()); - emit ctfVisualiserLoadTrace->action()->triggered(); - } - }); + if (ctfVisualiserLoadTrace) { + auto *action = ctfVisualiserLoadTrace->actionForContext(Core::Constants::C_GLOBAL); + const FilePath file = TemporaryDirectory::masterDirectoryFilePath() + / "cmake-profile.json"; + action->setData(file.nativePath()); + emit ctfVisualiserLoadTrace->action()->triggered(); + } + }); cmakeBuildSystem->runCMakeWithProfiling(); }