Fix FIFO usage

`m_propriorityQueue` and `m_queue` are used as FIFO queues, so we need
to use `takeFirst()` instead of `takeLast()` when removing elements
from the queue.

While at it, add a comment so that we will remember these are FIFO
queues.
This commit is contained in:
Elvis Angelaccio 2020-05-31 23:43:46 +02:00
parent 664f97ff0d
commit c16f777b28
2 changed files with 2 additions and 1 deletions

View file

@ -104,7 +104,7 @@ void KDirectoryContentsCounter::slotResult(const QString& path, int count, long
}
if (!m_priorityQueue.isEmpty()) {
startWorker(m_priorityQueue.takeLast());
startWorker(m_priorityQueue.takeFirst());
} else if (!m_queue.isEmpty()) {
startWorker(m_queue.takeFirst());
}

View file

@ -72,6 +72,7 @@ private:
private:
KFileItemModel* m_model;
// Used as FIFO queues.
QLinkedList<QString> m_priorityQueue;
QLinkedList<QString> m_queue;