C++: do not run GC when exiting.

This operation is quite costly if a lot of files are involved, and in
case of exiting Creator, it's also useless.

Change-Id: I97d178d47a3a2f6b214f7ebc45c871edd26b8286
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Erik Verbruggen
2013-04-19 16:56:12 +02:00
parent 564c9b2842
commit cd581ecd0b
2 changed files with 14 additions and 0 deletions

View File

@@ -626,6 +626,7 @@ CppModelManager *CppModelManager::instance()
CppModelManager::CppModelManager(QObject *parent)
: CppModelManagerInterface(parent)
, m_enableGC(true)
, m_completionAssistProvider(0)
, m_highlightingFactory(0)
, m_indexingSupporter(0)
@@ -656,6 +657,9 @@ CppModelManager::CppModelManager(QObject *parent)
connect(session, SIGNAL(aboutToUnloadSession(QString)),
this, SLOT(onAboutToUnloadSession()));
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()),
this, SLOT(onCoreAboutToClose()));
qRegisterMetaType<CPlusPlus::Document::Ptr>("CPlusPlus::Document::Ptr");
// thread connections
@@ -1209,8 +1213,16 @@ void CppModelManager::onAboutToUnloadSession()
GC();
}
void CppModelManager::onCoreAboutToClose()
{
m_enableGC = false;
}
void CppModelManager::GC()
{
if (!m_enableGC)
return;
Snapshot currentSnapshot = snapshot();
QSet<QString> processed;
QStringList todo = projectFiles();

View File

@@ -171,6 +171,7 @@ private Q_SLOTS:
void onExtraDiagnosticsUpdated(const QString &fileName);
void onAboutToRemoveProject(ProjectExplorer::Project *project);
void onAboutToUnloadSession();
void onCoreAboutToClose();
void onProjectAdded(ProjectExplorer::Project *project);
void postEditorUpdate();
void updateEditorSelections();
@@ -195,6 +196,7 @@ private:
private:
CPlusPlus::Snapshot m_snapshot;
bool m_enableGC;
// cache
bool m_dirty;