From 39d7aa7f70a30a53c55393298a16b61c6f5b1667 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 30 Aug 2018 10:53:50 +0200 Subject: [PATCH] QbsProjectManager: Only hold one build graph per project Keeping the build graphs of all enabled targets in memory does not scale. Task-number: QTCREATORBUG-20622 Change-Id: Iab711e7e789db51a5ee13aa9bf3c9fbb2e08aa89 Reviewed-by: hjk --- src/plugins/qbsprojectmanager/qbsproject.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index 22fcfc9dfad..c1645ea28e7 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -546,11 +546,19 @@ void QbsProject::handleRuleExecutionDone() void QbsProject::changeActiveTarget(Target *t) { - if (t) { - m_qbsProject = m_qbsProjects.value(t); - if (t->isActive()) - delayParsing(); + bool targetFound = false; + for (auto it = m_qbsProjects.begin(); it != m_qbsProjects.end(); ++it) { + qbs::Project &qbsProjectForTarget = it.value(); + if (it.key() == t) { + m_qbsProject = qbsProjectForTarget; + targetFound = true; + } else if (qbsProjectForTarget.isValid() && !BuildManager::isBuilding(it.key())) { + qbsProjectForTarget = qbs::Project(); + } } + QTC_ASSERT(targetFound || !t, m_qbsProject = qbs::Project()); + if (t && t->isActive()) + delayParsing(); } void QbsProject::startParsing()