aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@qt.io>2023-09-03 12:31:25 +0200
committerCristian Adam <cristian.adam@qt.io>2023-09-05 08:41:43 +0000
commite892a6224f5272e60070f8159bb4b5845062094f (patch)
tree1fc9871751fc6b10a0ad647afc5a3f0ed3bd64d3
parent3b11d2605f7b4ec9b0c7f352811fc5101f4af18d (diff)
CMakePM: Save document before doing file operations on the CMake
Fixes: QTCREATORBUG-29550 Change-Id: I5ec360a48adce0d51a7fbe1704c7d4a9125bd913 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
index c5e307cfb7..25120aea9e 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
@@ -272,6 +272,8 @@ bool CMakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FileP
const int targetDefinitionLine = target.backtrace.last().line;
// Have a fresh look at the CMake file, not relying on a cached value
+ Core::DocumentManager::saveModifiedDocumentSilently(
+ Core::DocumentModel::documentForFilePath(targetCMakeFile));
expected_str<QByteArray> fileContent = targetCMakeFile.fileContents();
cmListFile cmakeListFile;
std::string errorString;
@@ -397,6 +399,8 @@ CMakeBuildSystem::projectFileArgumentPosition(const QString &targetName, const Q
const FilePath targetCMakeFile = target.backtrace.last().path;
// Have a fresh look at the CMake file, not relying on a cached value
+ Core::DocumentManager::saveModifiedDocumentSilently(
+ Core::DocumentModel::documentForFilePath(targetCMakeFile));
expected_str<QByteArray> fileContent = targetCMakeFile.fileContents();
cmListFile cmakeListFile;
std::string errorString;