forked from qt-creator/qt-creator
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 <david.schulz@qt.io>
This commit is contained in:
@@ -94,6 +94,7 @@ void CppUseSelectionsUpdater::update(CallType callType)
|
|||||||
|
|
||||||
m_runnerWatcher->setFuture(cppEditorDocument->cursorInfo(params));
|
m_runnerWatcher->setFuture(cppEditorDocument->cursorInfo(params));
|
||||||
} else { // synchronous case
|
} else { // synchronous case
|
||||||
|
const int startRevision = cppEditorDocument->document()->revision();
|
||||||
QFuture<CursorInfo> future = cppEditorDocument->cursorInfo(params);
|
QFuture<CursorInfo> future = cppEditorDocument->cursorInfo(params);
|
||||||
|
|
||||||
// QFuture::waitForFinished seems to block completely, not even
|
// QFuture::waitForFinished seems to block completely, not even
|
||||||
@@ -102,6 +103,7 @@ void CppUseSelectionsUpdater::update(CallType callType)
|
|||||||
if (future.isCanceled())
|
if (future.isCanceled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QTC_ASSERT(startRevision == cppEditorDocument->document()->revision(), return);
|
||||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user