forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user