aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmakeprojectmanager
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-03-03 14:57:21 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2020-03-05 12:40:47 +0000
commitae0d2bd1ac4f8102be4e76ef6701a253fe6c9bc1 (patch)
tree99922f5aabd48398cd4da8a1a62c2f1df57cba62 /src/plugins/qmakeprojectmanager
parent5683f2df85be7607556ea09e5988e4c6de98c16c (diff)
QmakeProjectManager: Try harder not to access nodes of in-parse project
For extra safety, do not touch the project nodes if any build system of any build configuration is currently parsing. This is a bit of a stab in the dark, as I cannot reproduce the crash described in the linked bug report. Task-number: QTCREATORBUG-23597 Change-Id: Ie62a94232e89d8fba5866ea3572535e2ab209924 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/qmakeprojectmanager')
-rw-r--r--src/plugins/qmakeprojectmanager/profileeditor.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp
index 3d14ff3d500..a00e26d39e1 100644
--- a/src/plugins/qmakeprojectmanager/profileeditor.cpp
+++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp
@@ -37,6 +37,7 @@
#include <coreplugin/fileiconprovider.h>
#include <extensionsystem/pluginmanager.h>
#include <qtsupport/qtsupportconstants.h>
+#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/session.h>
@@ -85,12 +86,24 @@ QString ProFileEditorWidget::checkForPrfFile(const QString &baseName) const
{
const FilePath projectFile = textDocument()->filePath();
const QmakePriFileNode *projectNode = nullptr;
+
+ // FIXME: Remove this check once project nodes are fully "static".
for (const Project * const project : SessionManager::projects()) {
- if (Target *t = project->activeTarget()) {
- if (t->buildSystem()->isParsing())
- continue;
- }
- projectNode = dynamic_cast<const QmakePriFileNode *>(project->rootProjectNode()
+ static const auto isParsing = [](const Project *project) {
+ for (const Target * const t : project->targets()) {
+ for (const BuildConfiguration * const bc : t->buildConfigurations()) {
+ if (bc->buildSystem()->isParsing())
+ return true;
+ }
+ }
+ return false;
+ };
+ if (isParsing(project))
+ continue;
+
+ ProjectNode * const rootNode = project->rootProjectNode();
+ QTC_ASSERT(rootNode, continue);
+ projectNode = dynamic_cast<const QmakePriFileNode *>(rootNode
->findProjectNode([&projectFile](const ProjectNode *pn) {
return pn->filePath() == projectFile;
}));