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 <ABBAPOH@gmail.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Christian Kandeler
2019-05-06 14:03:03 +02:00
parent 6b2e09b08e
commit d0a51796a6

View File

@@ -26,9 +26,11 @@
#include "qbsrunconfiguration.h"
#include "qbsnodes.h"
#include "qbspmlogging.h"
#include "qbsprojectmanagerconstants.h"
#include "qbsproject.h"
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/localenvironmentaspect.h>
#include <projectexplorer/project.h>
@@ -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);
}