QbsProjectManager: Ensure project data update on target switch

... if necessary.

Fixes: QTCREATORBUG-23767
Change-Id: I9a79eebcab348fe0b37d76b31dcbf088d56fc3ca
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-03-30 17:08:16 +02:00
parent 11cd79adca
commit 3b740fccc8

View File

@@ -540,10 +540,20 @@ void QbsBuildSystem::handleQbsParsingDone(bool success)
bool dataChanged = false; bool dataChanged = false;
bool envChanged = m_lastParseEnv != m_qbsProjectParser->environment(); bool envChanged = m_lastParseEnv != m_qbsProjectParser->environment();
m_lastParseEnv = m_qbsProjectParser->environment(); m_lastParseEnv = m_qbsProjectParser->environment();
const bool isActiveBuildSystem = project()->activeTarget()
&& project()->activeTarget()->buildSystem() == this;
if (success) { if (success) {
const QJsonObject projectData = m_qbsProjectParser->session()->projectData(); const QJsonObject projectData = m_qbsProjectParser->session()->projectData();
if (projectData != m_projectData) { if (projectData != m_projectData) {
m_projectData = projectData; m_projectData = projectData;
dataChanged = isActiveBuildSystem;
} else if (isActiveBuildSystem
&& (!project()->rootProjectNode() || static_cast<QbsProjectNode *>(
project()->rootProjectNode())->projectData() != projectData)) {
// This is needed to trigger the necessary updates when switching targets.
// Nothing has changed on the BuildSystem side, but this build system's data now
// represents the project, so the data has changed from the overall project's
// point of view.
dataChanged = true; dataChanged = true;
} }
} else { } else {