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 <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2021-01-29 13:47:21 +01:00
parent 13f4519ed4
commit 64fc8a1fb6

View File

@@ -153,9 +153,9 @@ void DocumentLocatorFilter::prepareSearch(const QString &/*entry*/)
QList<Core::LocatorFilterEntry> DocumentLocatorFilter::matchesFor(
QFutureInterface<Core::LocatorFilterEntry> &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); });