summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2009-01-05 12:57:13 +0100
committerDanny Baumann <dannybaumann@web.de>2009-01-05 12:57:13 +0100
commitcc58577d8ea230de8cf029ccdabe62b07ab54ca9 (patch)
tree66dca7b9bbf101e5bfe9423b25599326f9052802
parentc2146a52a8a69428ae84627a64469b6a33d926e1 (diff)
Check return value of XGetWindowAttributes().
-rw-r--r--src/window.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/window.c b/src/window.c
index 1ccd0521..f638a9f4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1425,6 +1425,7 @@ bindWindow (CompWindow *w)
if (!w->pixmap)
{
XWindowAttributes attr;
+ Display *dpy = w->screen->display->display;
/* don't try to bind window again if it failed previously */
if (w->bindFailed)
@@ -1432,20 +1433,20 @@ bindWindow (CompWindow *w)
/* We have to grab the server here to make sure that window
is mapped when getting the window pixmap */
- XGrabServer (w->screen->display->display);
- XGetWindowAttributes (w->screen->display->display, w->id, &attr);
- if (attr.map_state != IsViewable)
+ XGrabServer (dpy);
+
+ if (!XGetWindowAttributes (dpy, w->id, &attr) ||
+ attr.map_state != IsViewable)
{
- XUngrabServer (w->screen->display->display);
+ XUngrabServer (dpy);
finiTexture (w->screen, w->texture);
w->bindFailed = TRUE;
return FALSE;
}
- w->pixmap = XCompositeNameWindowPixmap (w->screen->display->display,
- w->id);
+ w->pixmap = XCompositeNameWindowPixmap (dpy, w->id);
- XUngrabServer (w->screen->display->display);
+ XUngrabServer (dpy);
}
if (!bindPixmapToTexture (w->screen, w->texture, w->pixmap,