summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer/project.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-09-24 11:36:10 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-09-28 11:29:41 +0000
commit4c1c11b7b62ef231a2811d5ae94f7c36716230e0 (patch)
tree97d48887aadcd2bc69233e168a88ab3e4207348d /src/plugins/projectexplorer/project.cpp
parent2d1805a378d481f8238d6b7ba316495901f298f8 (diff)
downloadqt-creator-4c1c11b7b62ef231a2811d5ae94f7c36716230e0.tar.gz
QmakeProjectManager: Fix crash on reparsing
After a re-parse, the existing IDocuments need to be updated with the new QmakePriFile object, as the old one may no longer be valid and thus cause a crash on the next re-parse. Amends f3bd07efd1. Fixes: QTCREATORBUG-24683 Change-Id: Ib03d3005cb7831f1e05cb116aa3cdfe6cf5e72ad Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/project.cpp')
-rw-r--r--src/plugins/projectexplorer/project.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index 1ae6d33470..26ff818319 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -357,7 +357,8 @@ void Project::setNeedsInitialExpansion(bool needsExpansion)
}
void Project::setExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentPaths,
- const DocGenerator docGenerator)
+ const DocGenerator &docGenerator,
+ const DocUpdater &docUpdater)
{
QSet<Utils::FilePath> uniqueNewFiles = projectDocumentPaths;
uniqueNewFiles.remove(projectFilePath()); // Make sure to never add the main project file!
@@ -371,6 +372,10 @@ void Project::setExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentP
Utils::erase(d->m_extraProjectDocuments, [&toRemove](const std::unique_ptr<Core::IDocument> &d) {
return toRemove.contains(d->filePath());
});
+ if (docUpdater) {
+ for (const auto &doc : qAsConst(d->m_extraProjectDocuments))
+ docUpdater(doc.get());
+ }
for (const Utils::FilePath &p : toAdd) {
if (docGenerator) {
std::unique_ptr<Core::IDocument> doc = docGenerator(p);