From 3956d5b2793758b64da88d446a3420f23db95d0a Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Mon, 2 Oct 2023 14:25:58 +0200 Subject: [PATCH] CMakePM: Remove caching of CMakeTool No need to cache the value of the CMakeTool, since it causes issues with the update mechanism. Task-number: QTCREATORBUG-29683 Change-Id: Id5925b9a90d6010aa09b4a2f7b5ed3d447f5cd7a Reviewed-by: Jarek Kobus --- .../cmakeprojectmanager/cmaketoolmanager.cpp | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) 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; }