Commit cd581ecd authored by Erik Verbruggen's avatar Erik Verbruggen

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: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 564c9b28
......@@ -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();
......
......@@ -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;
......
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