forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user