From 27334cbe6dc662688cba750a4177b93950265310 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 1 Feb 2021 12:44:02 +0100 Subject: [PATCH] Compile fix in case of when HELP_NEW_FILTER_ENGINE is undefined Amends 8d06e66c49237ecee9c04ef6bde60f4251073e0f Change-Id: Ia7a81ed754c9f5cad9d9d51a89b9e1e1a7eddd03 Reviewed-by: Eike Ziller --- src/plugins/help/helpindexfilter.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index 6fe2f713745..4d0a89a08f9 100644 --- a/src/plugins/help/helpindexfilter.cpp +++ b/src/plugins/help/helpindexfilter.cpp @@ -89,12 +89,8 @@ void HelpIndexFilter::prepareSearch(const QString &entry) QList HelpIndexFilter::matchesFor(QFutureInterface &future, const QString &entry) { - m_mutex.lock(); // guard m_needsUpdate - bool forceUpdate = m_needsUpdate; - m_mutex.unlock(); - - if (forceUpdate || m_searchTermCache.size() < 2 || m_searchTermCache.isEmpty() - || !entry.contains(m_searchTermCache)) { + if (m_needsUpdate.exchange(false) || m_searchTermCache.size() < 2 + || m_searchTermCache.isEmpty() || !entry.contains(m_searchTermCache)) { int limit = entry.size() < 2 ? 200 : INT_MAX; QSet results; for (const QString &filePath : qAsConst(m_helpDatabases)) { @@ -108,9 +104,6 @@ QList HelpIndexFilter::matchesFor(QFutureInterface &future, QList HelpIndexFilter::matchesFor(QFutureInterface &future, const QString &entry) { - if (m_needsUpdate) { + if (m_needsUpdate.exchange(false)) { QStringList indices; QMetaObject::invokeMethod(this, [this] { return allIndices(); }, Qt::BlockingQueuedConnection, &indices); - m_needsUpdate = false; m_allIndicesCache = indices; // force updating the cache taking the m_allIndicesCache m_lastIndicesCache = QStringList();