From 585ac6cf9da5896753d33090320ebcc9c97cdda5 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Fri, 29 Jan 2010 13:12:42 +0100 Subject: QDir: clear internal file lists cache early MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the cache was invalidated (setPath, refresh, detach, etc.) then there is no sense to keep it any longer. Merge-request: 445 Reviewed-by: João Abecasis --- src/corelib/io/qdir.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 06ea95a..61f048a 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -131,6 +131,8 @@ private: inline void clear() { listsDirty = 1; + files.clear(); + fileInfos.clear(); } mutable QAtomicInt ref; @@ -269,10 +271,7 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l, QStringList *names, QFileInfoList *infos) const { - if(names) - names->clear(); - if(infos) - infos->clear(); + // names and infos are always empty lists or 0 here int n = l.size(); if(n > 0) { if (n == 1 || (sort & QDir::SortByMask) == QDir::Unsorted) { -- cgit v0.12