QbsProjectManager: Fix infinite loop when "force probes" is checked

This happened for all projects with a Qt dependency, because the module
provider kept recreating the Qt modules, which in turn caused Qt Creator
to re-parse the project.

Change-Id: I77c5c8723c1d0bcd477db648692ddaf9e060ce99
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Christian Kandeler
2019-04-03 16:57:18 +02:00
parent efb074dd39
commit 7e3356c324

View File

@@ -756,10 +756,16 @@ void QbsProject::updateDocuments(const QSet<QString> &files)
}
}
QSet<IDocument *> toAdd;
foreach (const QString &f, filesToAdd)
toAdd.insert(new ProjectDocument(Constants::MIME_TYPE, FileName::fromString(f),
[this]() { delayParsing(); }));
const FileName buildDir = FileName::fromString(m_projectData.buildDirectory());
for (const QString &f : qAsConst(filesToAdd)) {
// A changed qbs file (project, module etc) should trigger a re-parse, but not if
// the file was generated by qbs itself, in which case that might cause an infinite loop.
const FileName fp = FileName::fromString(f);
static const ProjectDocument::ProjectCallback noOpCallback = []{};
const ProjectDocument::ProjectCallback reparseCallback = [this]() { delayParsing(); };
toAdd.insert(new ProjectDocument(Constants::MIME_TYPE, fp, fp.isChildOf(buildDir)
? noOpCallback : reparseCallback));
}
m_qbsDocuments.unite(toAdd);
}