Fix a possible pixmap leak.

svn path=/trunk/KDE/kdebase/workspace/; revision=826826
This commit is contained in:
Luboš Luňák 2008-07-01 14:51:38 +00:00
parent e99c489ffe
commit 2bae5f1f4b

View file

@ -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;