summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-01-09 16:59:30 +0000
committerBrian Paul <[email protected]>2006-01-09 16:59:30 +0000
commit41b9756e9a2da55859581278e46da0e631866bc0 (patch)
tree2446071e64fa45a623e28e5e92411d0c86b5847b /src/mesa/drivers
parent8bc4dae67e083c6415c07e6ff77e700f7395dc9e (diff)
check XGetGeometry() return value
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/x11/xm_dd.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index 50382602a1b..931cdd28ab5 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -109,14 +109,23 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
winheight = MIN2(xmBuffer->frontxrb->drawable->height, MAX_HEIGHT);
#else
Window root;
+ Status stat;
int winx, winy;
unsigned int bw, d;
_glthread_LOCK_MUTEX(_xmesa_lock);
XSync(xmBuffer->xm_visual->display, 0); /* added for Chromium */
- XGetGeometry( xmBuffer->xm_visual->display, xmBuffer->frontxrb->pixmap,
+
+ stat = XGetGeometry( xmBuffer->xm_visual->display, xmBuffer->frontxrb->pixmap,
&root, &winx, &winy, &winwidth, &winheight, &bw, &d );
_glthread_UNLOCK_MUTEX(_xmesa_lock);
+
+ if (!stat) {
+ /* probably querying a window that's recently been destroyed */
+ _mesa_warning(NULL, "XGetGeometry failed!\n");
+ *width = *height = 1;
+ return;
+ }
#endif
*width = winwidth;
@@ -453,6 +462,9 @@ clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
register GLuint pixel = (GLuint) xmesa->clearpixel;
+ if (!xrb->ximage)
+ return;
+
if (xmesa->swapbytes) {
pixel = ((pixel >> 24) & 0x000000ff)
| ((pixel >> 8) & 0x0000ff00)