CMake: Do not crash when deleting cmake tools

Do not crash when the cmake tool that was used to parse the project
gets removed.

Change-Id: Ieda3ae2025dbcfb1f90d9bd01c5f0ed960756c6a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Tobias Hunger
2018-05-24 16:57:31 +02:00
parent b48742ad40
commit 88b065db3f
8 changed files with 45 additions and 28 deletions

View File

@@ -27,6 +27,7 @@
#include "cmakebuildconfiguration.h"
#include "cmakekitinformation.h"
#include "cmaketoolmanager.h"
#include <projectexplorer/kit.h>
#include <projectexplorer/kitinformation.h>
@@ -53,7 +54,7 @@ BuildDirParameters::BuildDirParameters(CMakeBuildConfiguration *bc)
environment = bc->environment();
cmakeTool = CMakeKitInformation::cmakeTool(k);
cmakeToolId = CMakeKitInformation::cmakeToolId(k);
auto tc = ToolChainKitInformation::toolChain(k, Constants::CXX_LANGUAGE_ID);
if (tc)
@@ -74,7 +75,12 @@ BuildDirParameters::BuildDirParameters(CMakeBuildConfiguration *bc)
generatorArguments = CMakeGeneratorKitInformation::generatorArguments(k);
}
bool BuildDirParameters::isValid() const { return buildConfiguration && cmakeTool; }
bool BuildDirParameters::isValid() const { return buildConfiguration && cmakeTool(); }
CMakeTool *BuildDirParameters::cmakeTool() const
{
return CMakeToolManager::findById(cmakeToolId);
}
BuildDirParameters::BuildDirParameters(const BuildDirParameters &) = default;