Synchronize all started threads in SemanticHighlighter d'tor

This fixes a possible crash on session switch or on shutdown.

Task-number: QTCREATORBUG-25708
Change-Id: I5dcc2420dca27b9856f47616c6f465ae8f059942
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2021-05-10 18:05:50 +02:00
parent b66a403f36
commit 1e26327472
2 changed files with 6 additions and 2 deletions

View File

@@ -560,8 +560,10 @@ void SemanticHighlighter::rerun(const QmlJSTools::SemanticInfo &semanticInfo)
m_watcher.cancel();
m_startRevision = m_document->document()->revision();
m_watcher.setFuture(Utils::runAsync(QThread::LowestPriority,
&SemanticHighlighter::run, this, semanticInfo));
auto future = Utils::runAsync(QThread::LowestPriority, &SemanticHighlighter::run,
this, semanticInfo);
m_watcher.setFuture(future);
m_futureSynchronizer.addFuture(future);
}
void SemanticHighlighter::cancel()