KDE/kdebase/workspace/plasma/applets/systemtray/protocols/fdo

Alexis Ménard menard at kde.org
Fri May 22 10:30:02 CEST 2009


SVN commit 971259 by menard:

Mr X really really love when we free his pixmap memory.

Hop hop hop, never forget to release the data that you allocate when
you return in the middle of a method. This code was leaking like a
hell. I'll close the bug open for that.

CCBUG:183191
CCMAIL:plasma-devel at kde.org

 M  +8 -3      x11embedcontainer.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/systemtray/protocols/fdo/x11embedcontainer.cpp #971258:971259
@@ -244,9 +244,11 @@
     else
       image = background.copy().toImage(); //With the X11 graphics engine, we have to create a copy first, else we get a crash
 
-    if(d->oldBackgroundImage == image)
+    if(d->oldBackgroundImage == image) {
+      XFreePixmap(display, bg);
+      XRenderFreePicture(display, picture);
       return;
-
+    }
     d->oldBackgroundImage = image;
 
     if (background.paintEngine()->type() != QPaintEngine::X11) {
@@ -342,8 +344,11 @@
             ximage.blue_mask    = 0x001f;
         }
         ximage.obdata           = 0;
-        if (XInitImage(&ximage) == 0)
+        if (XInitImage(&ximage) == 0) {
+            XRenderFreePicture(display, picture);
+            XFreePixmap(display, bg);
             return;
+        }
 
         Pixmap pm = XCreatePixmap(display, clientWinId(), width(), height(), ximage.depth);
         GC gc = XCreateGC(display, pm, 0, 0);


More information about the Plasma-devel mailing list