Store the document's revision used to compute the warning/error marks.

This commit is contained in:
Roberto Raggi
2009-07-10 13:57:21 +02:00
parent 29c3a674e5
commit 780abd0d4b
2 changed files with 7 additions and 0 deletions

View File

@@ -1316,6 +1316,7 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc)
}
Editor e;
e.revision = ed->document()->revision();
e.textEditor = textEditor;
e.selections = selections;
e.ifdefedOutBlocks = blockRanges;
@@ -1340,8 +1341,11 @@ void CppModelManager::updateEditorSelections()
TextEditor::ITextEditor *textEditor = ed.textEditor;
TextEditor::BaseTextEditor *editor = qobject_cast<TextEditor::BaseTextEditor *>(textEditor->widget());
if (! editor)
continue;
else if (editor->document()->revision() != ed.revision)
continue; // outdated
editor->setExtraSelections(TextEditor::BaseTextEditor::CodeWarningsSelection,
ed.selections);

View File

@@ -176,6 +176,9 @@ private:
mutable QMutex protectSnapshot;
struct Editor {
Editor()
: revision(-1) {}
int revision;
QPointer<TextEditor::ITextEditor> textEditor;
QList<QTextEdit::ExtraSelection> selections;
QList<TextEditor::BaseTextEditor::BlockRange> ifdefedOutBlocks;