┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2020-05-19 07:52:26 +0200
committerMéven Car <[email protected]>2020-05-20 07:45:58 +0200
commiteda05b12fbe4c3250727ee005a075374ccdf83e5 (patch)
tree357620319dde4b8c3cd554ff27a9dba99cca199e /src
parent3c9972179b567026f6be1cdde2e877bfd4a7eb6b (diff)
KDirectoryContentsCounter: don't schedule scanning a folder already in the Queue
Use a QLinkedList to check for presence in the queue. merge request !2
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/private/kdirectorycontentscounter.cpp6
-rw-r--r--src/kitemviews/private/kdirectorycontentscounter.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/kitemviews/private/kdirectorycontentscounter.cpp b/src/kitemviews/private/kdirectorycontentscounter.cpp
index a19bce8b3..a0ed8c27c 100644
--- a/src/kitemviews/private/kdirectorycontentscounter.cpp
+++ b/src/kitemviews/private/kdirectorycontentscounter.cpp
@@ -104,7 +104,7 @@ void KDirectoryContentsCounter::slotResult(const QString& path, int count, long
}
if (!m_queue.isEmpty()) {
- startWorker(m_queue.dequeue());
+ startWorker(m_queue.takeFirst());
}
if (s_cache->contains(resolvedPath)) {
@@ -175,7 +175,9 @@ void KDirectoryContentsCounter::startWorker(const QString& path)
}
if (m_workerIsBusy) {
- m_queue.enqueue(path);
+ if (!m_queue.contains(path)) {
+ m_queue.append(path);
+ }
} else {
KDirectoryContentsCounterWorker::Options options;
diff --git a/src/kitemviews/private/kdirectorycontentscounter.h b/src/kitemviews/private/kdirectorycontentscounter.h
index 0c900ec64..287227bff 100644
--- a/src/kitemviews/private/kdirectorycontentscounter.h
+++ b/src/kitemviews/private/kdirectorycontentscounter.h
@@ -23,7 +23,7 @@
#include "kdirectorycontentscounterworker.h"
-#include <QQueue>
+#include <QLinkedList>
#include <QSet>
#include <QHash>
@@ -72,7 +72,7 @@ private:
private:
KFileItemModel* m_model;
- QQueue<QString> m_queue;
+ QLinkedList<QString> m_queue;
static QThread* m_workerThread;