summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmapcache.cpp
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-05-06 06:55:50 (GMT)
committeraxis <qt-info@nokia.com>2009-05-06 06:55:50 (GMT)
commitb246f8a8beab858468777f433f49faf62edcb07e (patch)
tree120844101aca654bf2f69fef5ea2647bf0bee13a /src/gui/image/qpixmapcache.cpp
parent5791fde8526afc49cdbeee080ead9e8a305e3cd5 (diff)
parenta1d2c3c589a03cc427dcc22d109003576add9500 (diff)
downloadQt-b246f8a8beab858468777f433f49faf62edcb07e.zip
Qt-b246f8a8beab858468777f433f49faf62edcb07e.tar.gz
Qt-b246f8a8beab858468777f433f49faf62edcb07e.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/gui/image/qpixmapcache.cpp')
-rw-r--r--src/gui/image/qpixmapcache.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 4f1f0f0..c9973d0 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -189,6 +189,11 @@ bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
cacheKeys.insert(key, cacheKey);
return true;
}
+ qint64 oldCacheKey = cacheKeys.value(key, -1);
+ //If for the same key we add already a pixmap we should delete it
+ if (oldCacheKey != -1)
+ QCache<qint64, QDetachedPixmap>::remove(oldCacheKey);
+
bool success = QCache<qint64, QDetachedPixmap>::insert(cacheKey, new QDetachedPixmap(pixmap), cost);
if (success) {
cacheKeys.insert(key, cacheKey);