summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppmodelmanager.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2016-06-22 11:15:19 +0200
committerNikolai Kosjar <nikolai.kosjar@qt.io>2016-06-28 07:48:18 +0000
commitd63e27d877771a42464b53b53780e91dbb5f6ec7 (patch)
treebfa0afda9a3be7c4fcb7c9b1641fe7cb34c8e0fe /src/plugins/cpptools/cppmodelmanager.cpp
parent7d31cb0e18d9cf64748c8dfe98ef1d140d5d2626 (diff)
downloadqt-creator-d63e27d877771a42464b53b53780e91dbb5f6ec7.tar.gz
CppTools/Clang: Announce only removed project parts
...and not all projects parts of a project if it is closed. Re-produce with: open a project A with subdirs (e.g. qtcreator.pro) open a subdir project from project A (e.g. cppeditor.pro) close project A --> The project part representing the subdir is announced as removed although it is still open. The clang code model was the only affected user - affected translation units were not parsed/updated anymore ("ERROR: ProjectPartDoesNotExistMessage"). Change-Id: Ia79341ce201e3b4aefff9f597920dbc6f7d67634 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools/cppmodelmanager.cpp')
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index b27e86fe0a..71703246bc 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -996,34 +996,34 @@ void CppModelManager::delayedGC()
d->m_delayedGcTimer.start(500);
}
-static QStringList idsOfAllProjectParts(const ProjectInfo &projectInfo)
+static QStringList removedProjectParts(const QStringList &before, const QStringList &after)
{
- QStringList projectPaths;
- foreach (const ProjectPart::Ptr &part, projectInfo.projectParts())
- projectPaths << part->id();
- return projectPaths;
+ QSet<QString> b = before.toSet();
+ b.subtract(after.toSet());
+
+ return b.toList();
}
void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project)
{
- QStringList projectPartIds;
+ QStringList idsOfRemovedProjectParts;
d->m_projectToIndexerCanceled.remove(project);
{
QMutexLocker locker(&d->m_projectMutex);
d->m_dirty = true;
-
- // Save paths
- const ProjectInfo projectInfo = d->m_projectToProjectsInfo.value(project, ProjectInfo());
- projectPartIds = idsOfAllProjectParts(projectInfo);
+ const QStringList projectPartsIdsBefore = d->m_projectPartIdToProjectProjectPart.keys();
d->m_projectToProjectsInfo.remove(project);
recalculateProjectPartMappings();
+
+ const QStringList projectPartsIdsAfter = d->m_projectPartIdToProjectProjectPart.keys();
+ idsOfRemovedProjectParts = removedProjectParts(projectPartsIdsBefore, projectPartsIdsAfter);
}
- if (!projectPartIds.isEmpty())
- emit projectPartsRemoved(projectPartIds);
+ if (!idsOfRemovedProjectParts.isEmpty())
+ emit projectPartsRemoved(idsOfRemovedProjectParts);
delayedGC();
}