diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2010-01-29 12:12:42 (GMT) |
---|---|---|
committer | João Abecasis <joao@trolltech.com> | 2010-01-29 12:12:42 (GMT) |
commit | 585ac6cf9da5896753d33090320ebcc9c97cdda5 (patch) | |
tree | bdb37d1f20a83e3d91607cf8e84206521e6e0678 | |
parent | 9d713d7e73a88fe8328b55d2ab9af8c215dcb89d (diff) | |
download | Qt-585ac6cf9da5896753d33090320ebcc9c97cdda5.zip Qt-585ac6cf9da5896753d33090320ebcc9c97cdda5.tar.gz Qt-585ac6cf9da5896753d33090320ebcc9c97cdda5.tar.bz2 |
QDir: clear internal file lists cache early
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 <joao@trolltech.com>
-rw-r--r-- | src/corelib/io/qdir.cpp | 7 |
1 files 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) { |