summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-12-10 16:22:53 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-12-10 17:43:30 (GMT)
commit3a8a1f83d60ec16e4c61e2b0a327a5af02917a5a (patch)
treef73f7623cb2eb3fc76e4c1333364216d884ae4bd /src/gui/image
parentbf9456c5a2d8dfe9a35a2175186630cb426858ad (diff)
downloadQt-3a8a1f83d60ec16e4c61e2b0a327a5af02917a5a.zip
Qt-3a8a1f83d60ec16e4c61e2b0a327a5af02917a5a.tar.gz
Qt-3a8a1f83d60ec16e4c61e2b0a327a5af02917a5a.tar.bz2
Prevented leak of keys in QPixmapCache.
Removing a pixmap from the pixmap cache using the new QPixmapCache::Key API left the keys dangling in the QCache's internal QHash. The problem is that the Key is invalidated as soon as the QPixmapCacheEntry is destroyed, thus removing it from the hash failed. Reordering the destruction of the object and the removal of the key in QHash fixes the problem. Reviewed-by: Alexis Reviewed-by: Thiago
Diffstat (limited to 'src/gui/image')
-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 b0b7d72..b7b29d7 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -424,6 +424,11 @@ QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
Q_GLOBAL_STATIC(QPMCache, pm_cache)
+int Q_AUTOTEST_EXPORT q_QPixmapCache_keyHashSize()
+{
+ return pm_cache()->size();
+}
+
QPixmapCacheEntry::~QPixmapCacheEntry()
{
pm_cache()->releaseKey(key);