Commit 645cfb59 authored by Roberto Raggi's avatar Roberto Raggi

Ignore outdated parsing requests.

parent 7e5902f3
......@@ -49,6 +49,8 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager)
_modelManager(modelManager),
_updateDocumentInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL)
{
_revision = 0;
_updateDocumentTimer = new QTimer(this);
_updateDocumentTimer->setSingleShot(true);
_updateDocumentTimer->setInterval(_updateDocumentInterval);
......@@ -102,6 +104,8 @@ void CppEditorSupport::setUpdateDocumentInterval(int updateDocumentInterval)
void CppEditorSupport::updateDocument()
{
_revision = editorRevision();
if (TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor*>(_textEditor->widget())) {
const QList<QTextEdit::ExtraSelection> selections =
edit->extraSelections(TextEditor::BaseTextEditor::CodeWarningsSelection);
......@@ -114,7 +118,7 @@ void CppEditorSupport::updateDocument()
void CppEditorSupport::updateDocumentNow()
{
if (_documentParser.isRunning()) {
if (_documentParser.isRunning() || _revision != editorRevision()) {
_updateDocumentTimer->start(_updateDocumentInterval);
} else {
_updateDocumentTimer->stop();
......
......@@ -88,6 +88,7 @@ private:
int _updateDocumentInterval;
QFuture<void> _documentParser;
QString _cachedContents;
unsigned _revision;
};
} // namespace Internal
......
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