diff --git a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp index 6eb16cc4af1..3cb04046204 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp @@ -247,31 +247,12 @@ void CMakeToolManager::deregisterCMakeTool(const Id &id) CMakeTool *CMakeToolManager::defaultProjectOrDefaultCMakeTool() { - static CMakeTool *tool = nullptr; - - auto updateTool = [&] { - tool = nullptr; - if (auto bs = ProjectExplorer::ProjectTree::currentBuildSystem()) - tool = CMakeKitAspect::cmakeTool(bs->target()->kit()); - if (!tool) - tool = CMakeToolManager::defaultCMakeTool(); - }; + CMakeTool *tool = nullptr; + if (auto bs = ProjectExplorer::ProjectTree::currentBuildSystem()) + tool = CMakeKitAspect::cmakeTool(bs->target()->kit()); if (!tool) - updateTool(); - - QObject::connect(CMakeToolManager::instance(), - &CMakeToolManager::cmakeUpdated, - CMakeToolManager::instance(), - [&]() { updateTool(); }); - QObject::connect(CMakeToolManager::instance(), - &CMakeToolManager::cmakeRemoved, - CMakeToolManager::instance(), - [&]() { updateTool(); }); - QObject::connect(CMakeToolManager::instance(), - &CMakeToolManager::defaultCMakeChanged, - CMakeToolManager::instance(), - [&]() { updateTool(); }); + tool = CMakeToolManager::defaultCMakeTool(); return tool; }