diff options
author | hjk <hjk@qt.io> | 2020-02-27 14:46:16 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-02-27 16:27:34 +0000 |
commit | 488bd7eddbe83f00b4f61be4ddbaadd08bb52d16 (patch) | |
tree | 3960726664479b53d058e9264d58a48dd02359a0 /src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | |
parent | a670e203b1a78570ef969f893b470c68bed890a2 (diff) |
CMake: Check parseGuard.guardsProject()
... before overwriting the current guard, retaining the
state of the current guard in the error case.
Change-Id: I45ec43d48a9a13b9b59a5bbe6415a457b974b654
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp')
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 493939dd89..fa8396e92d 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -204,7 +204,7 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc) }); connect(project(), &Project::projectFileIsDirty, this, [this]() { - if (m_buildConfiguration->isActive()) { + if (m_buildConfiguration->isActive() && !isParsing()) { const auto cmake = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit()); if (cmake && cmake->isAutoRun()) { qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file"; @@ -235,9 +235,20 @@ CMakeBuildSystem::~CMakeBuildSystem() void CMakeBuildSystem::triggerParsing() { qCDebug(cmakeBuildSystemLog) << "Parsing has been triggered"; - m_currentGuard = guardParsingRun(); - QTC_ASSERT(m_currentGuard.guardsProject(), return ); + auto guard = guardParsingRun(); + + if (!guard.guardsProject()) { + // This can legitimately trigger if e.g. Build->Run CMake + // is selected while this here is already running. + + // FIXME: Instead of aborting the second run here we could try to + // cancel the first one in the Build->Run CMake handler and then + // continue to here normally. This here could then be an Assert. + return; + } + + m_currentGuard = std::move(guard); if (m_allFiles.isEmpty()) m_buildDirManager.requestFilesystemScan(); |