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

@@ -64,7 +64,7 @@ BuildDirManager::~BuildDirManager() = default;
Utils::FileName BuildDirManager::workDirectory(const BuildDirParameters &parameters) const
{
const Utils::FileName bdir = parameters.buildDirectory;
const CMakeTool *cmake = parameters.cmakeTool;
const CMakeTool *cmake = parameters.cmakeTool();
if (bdir.exists()) {
m_buildDirToTempDir.erase(bdir);
return bdir;
@@ -141,7 +141,7 @@ bool BuildDirManager::hasConfigChanged()
const CMakeConfig currentConfig = takeCMakeConfiguration();
const CMakeTool *tool = m_parameters.cmakeTool;
const CMakeTool *tool = m_parameters.cmakeTool();
QTC_ASSERT(tool, return false); // No cmake... we should not have ended up here in the first place
const QString extraKitGenerator = m_parameters.extraGenerator;
const QString mainKitGenerator = m_parameters.generator;
@@ -196,7 +196,7 @@ void BuildDirManager::setParametersAndRequestParse(const BuildDirParameters &par
int newReaderReparseOptions,
int existingReaderReparseOptions)
{
if (!parameters.cmakeTool) {
if (!parameters.cmakeTool()) {
TaskHub::addTask(Task::Error,
tr("The kit needs to define a CMake tool to parse this project."),
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
@@ -240,7 +240,7 @@ void BuildDirManager::becameDirty()
if (!m_parameters.buildConfiguration || !m_parameters.buildConfiguration->isActive())
return;
const CMakeTool *tool = m_parameters.cmakeTool;
const CMakeTool *tool = m_parameters.cmakeTool();
if (!tool->isAutoRun())
return;