summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2013-09-06 15:23:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-08 00:16:13 +0200
commit149f3efc39bebbe8fceacf2553836f90d2e1c383 (patch)
treebf877522407b318261044b60ceb2d666f3048c8d /src/plugins/platforms
parent4e6b696c085b4475dd3429822aed6839ac343760 (diff)
Be pedantic with Window's icon indexes.
Documentation for SHFILEINFO says iIcon is an index, so lets initialize defaultFolderIIcon with -1 so it doesn't clash with some icon that might exist at index 0. Change-Id: Ic16538ee62e5433f3cdcceee19eb5d8d18d55c1e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 498bd509fa..626659cc20 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -671,7 +671,7 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
static QCache<QString, FakePointer<int> > dirIconEntryCache(1000);
static QMutex mx;
- static int defaultFolderIIcon = 0;
+ static int defaultFolderIIcon = -1;
const bool useDefaultFolderIcon = iconOptions & QPlatformTheme::DontUseCustomDirectoryIcons;
QPixmap pixmap;
@@ -687,8 +687,8 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
bool cacheableDirIcon = fileInfo.isDir() && !fileInfo.isRoot();
if (cacheableDirIcon) {
QMutexLocker locker(&mx);
- int iIcon = (useDefaultFolderIcon && defaultFolderIIcon) ? defaultFolderIIcon
- : **dirIconEntryCache.object(filePath);
+ int iIcon = (useDefaultFolderIcon && defaultFolderIIcon >= 0) ? defaultFolderIIcon
+ : **dirIconEntryCache.object(filePath);
if (iIcon) {
QPixmapCache::find(dirIconPixmapCacheKey(iIcon, iconSize, requestedImageListSize), pixmap);
if (pixmap.isNull()) // Let's keep both caches in sync
@@ -720,7 +720,7 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
if (val && info.hIcon) {
QString key;
if (cacheableDirIcon) {
- if (useDefaultFolderIcon && !defaultFolderIIcon)
+ if (useDefaultFolderIcon && defaultFolderIIcon < 0)
defaultFolderIIcon = info.iIcon;
//using the unique icon index provided by windows save us from duplicate keys