summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppmodelmanager.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2013-07-17 13:50:38 +0200
committerNikolai Kosjar <nikolai.kosjar@digia.com>2013-08-08 12:12:31 +0200
commit2665a1249bd666b260455b43462dcebcefaa3ff4 (patch)
tree92ce5a0c0387e22ab4701eb6f59dabee04220122 /src/plugins/cpptools/cppmodelmanager.cpp
parent7583039b87c2908d40017ba1c245fed0b471c0f9 (diff)
downloadqt-creator-2665a1249bd666b260455b43462dcebcefaa3ff4.tar.gz
CppTools: Do not garbage collect files in the working copy
...except the configuration file if no projects are open. For this case there is no need to keep the configuration file around. Task-number: QTCREATORBUG-9829 Change-Id: I51b01b30c17cbc1ced491ef2c47c338dae6ed983 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppmodelmanager.cpp')
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index cc1979d6b7..d9f53f2f5d 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -714,9 +714,28 @@ void CppModelManager::GC()
if (!m_enableGC)
return;
- const Snapshot currentSnapshot = snapshot();
+ // Collect files of CppEditorSupport and AbstractEditorSupport.
+ QStringList filesInEditorSupports;
+ QList<CppEditorSupport *> cppEditorSupports;
+ {
+ QMutexLocker locker(&m_cppEditorSupportsMutex);
+ cppEditorSupports = m_cppEditorSupports.values();
+ }
+ foreach (const CppEditorSupport *cppEditorSupport, cppEditorSupports)
+ filesInEditorSupports << cppEditorSupport->fileName();
+
+ QSetIterator<AbstractEditorSupport *> jt(m_extraEditorSupports);
+ while (jt.hasNext()) {
+ AbstractEditorSupport *abstractEditorSupport = jt.next();
+ filesInEditorSupports << abstractEditorSupport->fileName();
+ }
+
+ Snapshot currentSnapshot = snapshot();
QSet<QString> reachableFiles;
- QStringList todo = projectFiles();
+ // The configuration file is part of the project files, which is just fine.
+ // If single files are open, without any project, then there is no need to
+ // keep the configuration file around.
+ QStringList todo = filesInEditorSupports + projectFiles();
// Collect all files that are reachable from the project files
while (!todo.isEmpty()) {