CppTools: Move GC() call from CppEditorWidget to CppModelManager

There is no need to have that logic in CppEditorWidget. The
CppModelManager knows how many editors are open and can therefore call
GC() by itself.

Change-Id: I2ed4051ad7b8c87615014d73e29291027d49d2ab
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-07-16 16:14:47 +02:00
parent 0e62487fb3
commit bc4fa63f84
2 changed files with 9 additions and 9 deletions

View File

@@ -322,8 +322,6 @@ struct CanonicalSymbol
};
int numberOfClosedEditors = 0;
/// Check if previous line is a CppStyle Doxygen Comment
bool isPreviousLineCppStyleComment(const QTextCursor &cursor)
{
@@ -565,13 +563,6 @@ CPPEditorWidget::~CPPEditorWidget()
if (m_modelManager)
m_modelManager->deleteEditorSupport(editor());
++numberOfClosedEditors;
if (numberOfClosedEditors == 5) {
if (m_modelManager)
m_modelManager->GC();
numberOfClosedEditors = 0;
}
delete m_completionSupport;
}

View File

@@ -610,6 +610,8 @@ QList<ProjectPart::Ptr> CppModelManager::projectPart(const QString &fileName) co
/// \brief Removes the CppEditorSupport for the closed editor.
void CppModelManager::deleteEditorSupport(TextEditor::BaseTextEditor *textEditor)
{
static short numberOfClosedEditors = 0;
QTC_ASSERT(textEditor, return);
if (!isCppEditor(textEditor))
@@ -624,6 +626,13 @@ void CppModelManager::deleteEditorSupport(TextEditor::BaseTextEditor *textEditor
}
delete editorSupport;
++numberOfClosedEditors;
if (numberOfClosedEditors == 5) {
numberOfClosedEditors = 0;
GC();
}
}
bool CppModelManager::isCppEditor(Core::IEditor *editor) const