From: Vishesh Handa Date: Fri, 08 Feb 2013 20:58:33 +0000 Subject: Revert "BasicIndexingQueue: Use stacks instead of queues" X-Git-Url: http://quickgit.kde.org/?p=nepomuk-core.git&a=commitdiff&h=b651f9231ac30072418bb06d602951f0f05da22c --- Revert "BasicIndexingQueue: Use stacks instead of queues" This reverts commit 2f33141aa6716550e38b11ec9a0b000dd74eea79. The commit breaks recursive indexing. Doh! BUG: 314559 --- --- a/services/fileindexer/basicindexingqueue.cpp +++ b/services/fileindexer/basicindexingqueue.cpp @@ -54,14 +54,14 @@ void BasicIndexingQueue::clear(const QString& path) { - QMutableVectorIterator< QPair > it( m_paths ); + QMutableListIterator< QPair > it( m_paths ); while( it.hasNext() ) { it.next(); if( it.value().first.startsWith( path ) ) it.remove(); } - QMutableVectorIterator< QPair > iter( m_iterators ); + QMutableListIterator< QPair > iter( m_iterators ); while( iter.hasNext() ) { QDirIterator* dirIter = iter.next().first; @@ -100,7 +100,7 @@ { kDebug() << path; bool wasEmpty = m_paths.empty(); - m_paths.push( qMakePair( path, flags ) ); + m_paths.enqueue( qMakePair( path, flags ) ); callForNextIteration(); if( wasEmpty ) @@ -120,12 +120,12 @@ processingFile = process( dirIt->next(), pair.second ); } else { - delete m_iterators.pop().first; + delete m_iterators.dequeue().first; } } else if( !m_paths.isEmpty() ) { - QPair< QString, UpdateDirFlags > pair = m_paths.pop(); + QPair< QString, UpdateDirFlags > pair = m_paths.dequeue(); processingFile = process( pair.first, pair.second ); } @@ -161,7 +161,7 @@ QDir::Filters dirFilter = QDir::NoDotAndDotDot|QDir::Readable|QDir::Files|QDir::Dirs; QPair pair = qMakePair( new QDirIterator( path, dirFilter ), flags ); - m_iterators.push( pair ); + m_iterators.enqueue( pair ); } } else if( info.isFile() && (forced || indexingRequired) ) { @@ -259,12 +259,6 @@ emit endIndexingFile( url ); - // Give back the memory - if( m_paths.isEmpty() ) - m_paths.clear(); - if( m_iterators.isEmpty() ) - m_iterators.clear(); - // Continue the queue finishIteration(); } --- a/services/fileindexer/basicindexingqueue.h +++ b/services/fileindexer/basicindexingqueue.h @@ -23,7 +23,6 @@ #include "indexingqueue.h" #include -#include namespace Nepomuk2 { @@ -106,8 +105,8 @@ */ bool process(const QString& path, Nepomuk2::UpdateDirFlags flags); - QStack< QPair > m_paths; - QStack< QPair > m_iterators; + QQueue< QPair > m_paths; + QQueue< QPair > m_iterators; QUrl m_currentUrl; QString m_currentMimeType;