forked from qt-creator/qt-creator
C++: prevent possibly highlighting a document twice
Possible when the highlighter does not need semantic info to run, and is started through onDocumentUpdated() and updateDocumentNow(). Change-Id: I720299730213ac196143a273fb60cee8e43111f1 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
@@ -392,10 +392,14 @@ void CppEditorSupport::startHighlighting()
|
||||
m_lastHighlightRevision = revision;
|
||||
emit highlighterStarted(&m_highlighter, m_lastHighlightRevision);
|
||||
} else {
|
||||
const unsigned revision = currentSource(false).revision;
|
||||
if (m_lastHighlightRevision == revision)
|
||||
return;
|
||||
|
||||
m_lastHighlightRevision = revision;
|
||||
static const Document::Ptr dummyDoc;
|
||||
static const Snapshot dummySnapshot;
|
||||
m_highlighter = m_highlightingSupport->highlightingFuture(dummyDoc, dummySnapshot);
|
||||
m_lastHighlightRevision = editorRevision();
|
||||
emit highlighterStarted(&m_highlighter, m_lastHighlightRevision);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user