CppEditor: Avoid premature calls to recalculateSemanticInfoNow

Now recalculateSemanticInfoNow is called only once instead of three
times when a new editor is opened/created.

Change-Id: Ife84fc9ca90cdbf2a417123e6a2b9e1e068dfdc4
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-05-06 14:59:15 +02:00
parent 7313203c29
commit cacd66195c
3 changed files with 21 additions and 3 deletions

View File

@@ -175,6 +175,11 @@ void CppEditorSupport::setExtraDiagnostics(const QString &key,
emit diagnosticsChanged();
}
bool CppEditorSupport::initialized()
{
return m_initialized;
}
SemanticInfo CppEditorSupport::recalculateSemanticInfo(bool emitSignalWhenFinished)
{
m_futureSemanticInfo.cancel();
@@ -186,6 +191,11 @@ SemanticInfo CppEditorSupport::recalculateSemanticInfo(bool emitSignalWhenFinish
void CppEditorSupport::recalculateSemanticInfoDetached(bool force)
{
// Block premature calculation caused by CppEditorPlugin::currentEditorChanged
// when the editor is created.
if (!m_initialized)
return;
m_futureSemanticInfo.cancel();
SemanticInfo::Source source = currentSource(force);
m_futureSemanticInfo = QtConcurrent::run<CppEditorSupport, void>(