Commit bc4fa63f authored by Nikolai Kosjar's avatar Nikolai Kosjar

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: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 0e62487f
......@@ -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;
}
......
......@@ -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
......
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