forked from qt-creator/qt-creator
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 <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -247,31 +247,12 @@ void CMakeToolManager::deregisterCMakeTool(const Id &id)
|
|||||||
|
|
||||||
CMakeTool *CMakeToolManager::defaultProjectOrDefaultCMakeTool()
|
CMakeTool *CMakeToolManager::defaultProjectOrDefaultCMakeTool()
|
||||||
{
|
{
|
||||||
static CMakeTool *tool = nullptr;
|
CMakeTool *tool = nullptr;
|
||||||
|
|
||||||
auto updateTool = [&] {
|
|
||||||
tool = nullptr;
|
|
||||||
if (auto bs = ProjectExplorer::ProjectTree::currentBuildSystem())
|
if (auto bs = ProjectExplorer::ProjectTree::currentBuildSystem())
|
||||||
tool = CMakeKitAspect::cmakeTool(bs->target()->kit());
|
tool = CMakeKitAspect::cmakeTool(bs->target()->kit());
|
||||||
if (!tool)
|
if (!tool)
|
||||||
tool = CMakeToolManager::defaultCMakeTool();
|
tool = CMakeToolManager::defaultCMakeTool();
|
||||||
};
|
|
||||||
|
|
||||||
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(); });
|
|
||||||
|
|
||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user