File fix-pixmaploader.diff of Package thinkeramik
------------------------------------------------------------------------
r559665 | orlovich | 2006-07-08 01:56:40 +0200 (Sat, 08 Jul 2006) | 4 lines
Fix memory leak with super-large widgets, reported by Martin Pley.
(Also fix my addy as I am touching the file)
------------------------------------------------------------------------
--- widget-engine/pixmaploader.cpp (revision 559664)
+++ widget-engine/pixmaploader.cpp (revision 559665)
@@ -290,13 +290,17 @@ QPixmap PixmapLoader::scale( int name, i
else
result = new QPixmap(img->smoothScale( width ? width : img->width(),
height ? height: img->height()));
+ delete img;
ThinKeramikCacheEntry* toAdd = new ThinKeramikCacheEntry(entry);
toAdd->m_pixmap = result;
- m_pixmapCache.insert(key, toAdd, result->width()*result->height()*result->depth()/8);
-
- delete img;
+ if (!m_pixmapCache.insert(key, toAdd, result->width()*result->height()*result->depth()/8)) {
+ QPixmap toRet = *result;
+ delete toAdd;
+ return toRet;
+ }
+
return *result;
}