Commit d63e27d8 authored by Nikolai Kosjar's avatar Nikolai Kosjar

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.
  open a subdir project from project A (e.g.
  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: default avatarDavid Schulz <>
parent 7d31cb0e
......@@ -996,34 +996,34 @@ void CppModelManager::delayedGC()
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();
return b.toList();
void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project)
QStringList projectPartIds;
QStringList idsOfRemovedProjectParts;
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();
const QStringList projectPartsIdsAfter = d->m_projectPartIdToProjectProjectPart.keys();
idsOfRemovedProjectParts = removedProjectParts(projectPartsIdsBefore, projectPartsIdsAfter);
if (!projectPartIds.isEmpty())
emit projectPartsRemoved(projectPartIds);
if (!idsOfRemovedProjectParts.isEmpty())
emit projectPartsRemoved(idsOfRemovedProjectParts);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment