Use QMutexLocker in conjunction with QWaitCondition

Change-Id: Ia5d55b9161a58387b0806e792f0fb1b21f118330
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2021-02-18 18:35:01 +01:00
parent 2d8dff4a8a
commit aef1bb943d

View File

@@ -168,12 +168,11 @@ void SpotlightIterator::ensureNext()
if (m_index + 1 < m_filePaths.size()) // nothing to do
return;
// check if there are items in the queue, otherwise wait for some
m_mutex.lock();
QMutexLocker lock(&m_mutex);
if (m_queue.isEmpty() && !m_finished)
m_waitForItems.wait(&m_mutex);
m_filePaths.append(m_queue);
m_queue.clear();
m_mutex.unlock();
}
// #pragma mark -- SpotlightLocatorFilter