From 9f48b9dd0213cd3eada78f254cb59e8f83a4cc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 5 Jan 2007 16:13:57 +0000 Subject: [PATCH] But now there's a race condition - use a server grab to atomatically check if the window still exists and selecting for events on it. svn path=/branches/work/kwin_composite/; revision=620295 --- unmanaged.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unmanaged.cpp b/unmanaged.cpp index 9c01cd5971..3786517da7 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -31,10 +31,17 @@ Unmanaged::~Unmanaged() bool Unmanaged::track( Window w ) { XWindowAttributes attr; + grabXServer(); if( !XGetWindowAttributes(display(), w, &attr)) + { + ungrabXServer(); return false; + } if( attr.c_class == InputOnly ) + { + ungrabXServer(); return false; + } setHandle( w ); XSelectInput( display(), w, StructureNotifyMask ); geom = QRect( attr.x, attr.y, attr.width, attr.height ); @@ -54,6 +61,7 @@ bool Unmanaged::track( Window w ) XShapeSelectInput( display(), w, ShapeNotifyMask ); detectShape( w ); setupCompositing(); + ungrabXServer(); return true; }