From 64fc8a1fb66c2737f46bfd214f242511a4e3cf26 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 29 Jan 2021 13:47:21 +0100 Subject: [PATCH] DocumentLocatorFilter: protect with mutex a check for symbol cache The value of m_symbolCache may change at any time in gui thread inside a call to updateCurrentClient(). Change-Id: I6aad37281ce8ec08f7b0ea5b2143e28dee507f72 Reviewed-by: Eike Ziller --- src/plugins/languageclient/locatorfilter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/languageclient/locatorfilter.cpp b/src/plugins/languageclient/locatorfilter.cpp index 2f8d8744694..e51aed5aa74 100644 --- a/src/plugins/languageclient/locatorfilter.cpp +++ b/src/plugins/languageclient/locatorfilter.cpp @@ -153,9 +153,9 @@ void DocumentLocatorFilter::prepareSearch(const QString &/*entry*/) QList DocumentLocatorFilter::matchesFor( QFutureInterface &future, const QString &entry) { + QMutexLocker locker(&m_mutex); if (!m_symbolCache) return {}; - QMutexLocker locker(&m_mutex); if (!m_currentSymbols.has_value()) { QEventLoop loop; connect(this, &DocumentLocatorFilter::symbolsUpToDate, &loop, [&]() { loop.exit(1); });