[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Small memory leak in krayon
From:       Patrick Julien <freak () ideasandassociates ! com>
Date:       2002-02-09 21:12:55
[Download RAW message or body]

I believe this patch fixes a small memory leak in krayon... now, I'm 
just looking around krayon for fun...  don't flame me if I formatted the 
patch wrong, fixed an inexistent bug, got the indentation wrong, or 
simply pissing off the maintainer, OK?

Index: kis_brush.cc
===================================================================
RCS file: /home/kde/koffice/krayon/core/kis_brush.cc,v
retrieving revision 1.17
diff -u -3 -p -u -r1.17 kis_brush.cc
--- kis_brush.cc        2001/09/05 17:03:01     1.17
+++ kis_brush.cc        2002/02/09 21:07:51
@@ -126,8 +126,6 @@ void KisBrush::loadViaQImage(QString fil
         filePixmap.load(file);
         QImage fileImage = filePixmap.convertToImage();

-        m_pThumbPixmap = new QPixmap;
-
         int xsize = THUMB_SIZE;
         int ysize = THUMB_SIZE;
         int picW  = fileImage.width();
@@ -152,10 +150,16 @@ void KisBrush::loadViaQImage(QString fil

         if(!thumbImg.isNull())
         {
+            m_pThumbPixmap = new QPixmap;
             m_pThumbPixmap->convertFromImage(thumbImg);
             if(!m_pThumbPixmap->isNull())
             {
                 validThumb = true;
+            }
+            else
+            {
+                delete m_pThumbPixmap;
+                m_pThumbPixmap = 0;
             }
         }
     }

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic