Clang: Avoid blocking UI if references are requested and clangbackend crashes

The two cases in which the UI might be blocked are:
 * Invocation of the editor context menu
 * Rename Symbol Under Cursor

Cancel the future if the backend is restarted and on the other side,
check whether the future is cancelled.

Change-Id: If2315da1f66f15eab1531fcd8da1dff851a9a4e6
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2017-07-14 09:42:05 +02:00
parent db88225b0e
commit 8309e0c56a
3 changed files with 21 additions and 11 deletions

View File

@@ -98,8 +98,12 @@ void CppUseSelectionsUpdater::update(CallType callType)
// QFuture::waitForFinished seems to block completely, not even
// allowing to process events from QLocalSocket.
while (!future.isFinished())
while (!future.isFinished()) {
if (future.isCanceled())
return;
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
}
processResults(future.result());
}