Contents of /trunk/qt4/patches/qt-4.5.1-qt-copy_fix-qpixmapcache-leak.patch
Parent Directory | Revision Log
Revision 835 -
(show annotations)
(download)
Mon Jun 8 21:21:53 2009 UTC (15 years, 3 months ago) by niro
File size: 896 byte(s)
Mon Jun 8 21:21:53 2009 UTC (15 years, 3 months ago) by niro
File size: 896 byte(s)
more patches
1 | qt-bugs@ issue : none |
2 | Qt Software task ID : none |
3 | bugs.kde.org number : 183191 |
4 | applied: yes |
5 | author: Alexis Menard <alexis.menard@nokia.com> |
6 | |
7 | Make sure that QPixmapCache release the old pixmap if |
8 | you reinsert a QPixmap with the same key. |
9 | |
10 | This patch is already in 4.5 branch. |
11 | |
12 | --- src/gui/image/qpixmapcache.cpp |
13 | +++ src/gui/image/qpixmapcache.cpp |
14 | @@ -187,6 +187,11 @@ bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost) |
15 | cacheKeys.insert(key, cacheKey); |
16 | return true; |
17 | } |
18 | + qint64 oldCacheKey = cacheKeys.value(key, -1); |
19 | + //If for the same key we add already a pixmap we should delete it |
20 | + if (oldCacheKey != -1) |
21 | + QCache<qint64, QDetachedPixmap>::remove(oldCacheKey); |
22 | + |
23 | bool success = QCache<qint64, QDetachedPixmap>::insert(cacheKey, new QDetachedPixmap(pixmap), cost); |
24 | if (success) { |
25 | cacheKeys.insert(key, cacheKey); |