From 6b2d6e7965aedbb71856b660883cc7676a78faf0 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 21 Jul 2017 13:53:33 +0200 Subject: [PATCH] CppEditor: Cancel waiting for use selections if revision changed Not sure whether this can happen at all, but if it can, we should not make the UI unusable. Change-Id: I1a40630d0c1f057e20a33b2c755e1fd5aea0b003 Reviewed-by: David Schulz --- src/plugins/cppeditor/cppuseselectionsupdater.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/cppeditor/cppuseselectionsupdater.cpp b/src/plugins/cppeditor/cppuseselectionsupdater.cpp index 81e1436ccde..4e13fee5975 100644 --- a/src/plugins/cppeditor/cppuseselectionsupdater.cpp +++ b/src/plugins/cppeditor/cppuseselectionsupdater.cpp @@ -94,6 +94,7 @@ void CppUseSelectionsUpdater::update(CallType callType) m_runnerWatcher->setFuture(cppEditorDocument->cursorInfo(params)); } else { // synchronous case + const int startRevision = cppEditorDocument->document()->revision(); QFuture future = cppEditorDocument->cursorInfo(params); // QFuture::waitForFinished seems to block completely, not even @@ -102,6 +103,7 @@ void CppUseSelectionsUpdater::update(CallType callType) if (future.isCanceled()) return; + QTC_ASSERT(startRevision == cppEditorDocument->document()->revision(), return); QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); }