From 2bae5f1f4b60b153c40fadcc585d8413f6b0c936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 1 Jul 2008 14:51:38 +0000 Subject: [PATCH] Fix a possible pixmap leak. svn path=/trunk/KDE/kdebase/workspace/; revision=826826 --- composite.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/composite.cpp b/composite.cpp index 1f7ab8b739..0a5aab41b8 100644 --- a/composite.cpp +++ b/composite.cpp @@ -478,7 +478,7 @@ Pixmap Toplevel::createWindowPixmap() assert( compositing()); grabXServer(); KXErrorHandler err; - window_pix = XCompositeNameWindowPixmap( display(), frameId()); + Pixmap pix = XCompositeNameWindowPixmap( display(), frameId()); // check that the received pixmap is valid and actually matches what we // know about the window (i.e. size) XWindowAttributes attrs; @@ -489,8 +489,13 @@ Pixmap Toplevel::createWindowPixmap() if( attrs.width != width() || attrs.height != height() || attrs.map_state != IsViewable ) window_pix = None; ungrabXServer(); - if( window_pix == None ) + if( window_pix == None || pix == None ) + { kDebug( 1212 ) << "Creating window pixmap failed: " << this; + if( pix != None ) + XFreePixmap( display(), pix ); + } + window_pix = pix; return window_pix; #else return None;