diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-12-10 16:22:53 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-12-10 17:43:30 (GMT) |
commit | 3a8a1f83d60ec16e4c61e2b0a327a5af02917a5a (patch) | |
tree | f73f7623cb2eb3fc76e4c1333364216d884ae4bd /src/corelib/tools | |
parent | bf9456c5a2d8dfe9a35a2175186630cb426858ad (diff) | |
download | Qt-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/corelib/tools')
-rw-r--r-- | src/corelib/tools/qcache.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index 46e20b1..ee9523f 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -70,8 +70,8 @@ class QCache if (l == &n) l = n.p; if (f == &n) f = n.n; total -= n.c; - delete n.t; hash.remove(*n.keyPtr); + delete n.t; } inline T *relink(const Key &key) { typename QHash<Key, Node>::iterator i = hash.find(key); |