aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2021-02-01 12:44:02 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2021-02-01 13:05:15 +0000
commit27334cbe6dc662688cba750a4177b93950265310 (patch)
treec478a2681ea9db0ad0f051940adf012ee157773f /src/plugins/help
parentd3ffbea8a012c44294fc4b01a6ce9a3e7920c8f1 (diff)
Compile fix in case of when HELP_NEW_FILTER_ENGINE is undefined
Amends 8d06e66c49237ecee9c04ef6bde60f4251073e0f Change-Id: Ia7a81ed754c9f5cad9d9d51a89b9e1e1a7eddd03 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/help')
-rw-r--r--src/plugins/help/helpindexfilter.cpp14
1 files 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<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &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<QString> results;
for (const QString &filePath : qAsConst(m_helpDatabases)) {
@@ -108,9 +104,6 @@ QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFi
Q_ARG(int, limit));
results.unite(result);
}
- m_mutex.lock(); // guard m_needsUpdate
- m_needsUpdate = false;
- m_mutex.unlock();
m_keywordCache = results;
m_searchTermCache = entry;
}
@@ -174,11 +167,10 @@ bool HelpIndexFilter::updateCache(QFutureInterface<LocatorFilterEntry> &future,
QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &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();