All pastes #81466 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-07-07 14:35 UTC
rendered paste body
--- keramik/pixmaploader.cpp    (revision 559148)
+++ keramik/pixmaploader.cpp    (working copy)
@@ -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;

        KeramikCacheEntry* toAdd = new KeramikCacheEntry(entry);
        toAdd->m_pixmap = result;

-       m_pixmapCache.insert(key, toAdd, result->width()*result->height()*result->depth()/8);
+       if (!m_pixmapCache.insert(key, toAdd, result->width()*result->height()*result->depth()/8)) {
+               QPixmap toRet = *result;
+               delete toAdd;
+               return toRet;
+       }

-       delete img;
        return *result;
 }