From d0a51796a6ae74496612366a07b0eb3299977284 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 6 May 2019 14:03:03 +0200 Subject: [PATCH] QbsProjectManager: Skip run environment retrieval if project is parsing ...or building. We must not access the internal state of qbs::Project while a parse or build is going on, as that could lead to race conditions. This can potentially leave the run configuration with an incomplete environment temporarily, but eventually we'll get the correct one once the project has finished parsing. Fixes: QTCREATORBUG-22386 Change-Id: Iee3c36aadae9e3a6070993436890eb1ee89354e6 Reviewed-by: Ivan Komissarov Reviewed-by: Joerg Bornemann --- src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp index c68ef96122e..03cff5f4eb9 100644 --- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp +++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp @@ -26,9 +26,11 @@ #include "qbsrunconfiguration.h" #include "qbsnodes.h" +#include "qbspmlogging.h" #include "qbsprojectmanagerconstants.h" #include "qbsproject.h" +#include #include #include #include @@ -123,8 +125,13 @@ void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const return; } BuildTargetInfo bti = buildTargetInfo(); - if (bti.runEnvModifier) + if (bti.runEnvModifier) { + if (project()->isParsing() || BuildManager::isBuilding(target())) { + qCDebug(qbsPmLog) << "qbs project in flux, cannot modify environment"; + return; // Intentionally skips the cache update below. + } bti.runEnvModifier(env, usingLibraryPaths); + } m_envCache.insert(key, env); }