aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/sw
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-10-21 19:49:32 -0600
committerBrian Paul <[email protected]>2010-10-21 19:49:34 -0600
commit3bc6fe371cf6a5f75ff11b840e289ff8084f5d7b (patch)
treec7ca13ba8bfa681c2f92723f0f1a6b648d15c338 /src/gallium/winsys/sw
parent4d24f01cb38bbf5d7a47786a1586f8a77360d2d9 (diff)
winsys/xlib: fix up allocation/dealloction of XImage
Fixes a crash upon exit when using remote display.
Diffstat (limited to 'src/gallium/winsys/sw')
-rw-r--r--src/gallium/winsys/sw/xlib/xlib_sw_winsys.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
index 003fa628cc2..00fc0b7525a 100644
--- a/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
+++ b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
@@ -196,11 +196,14 @@ alloc_ximage(struct xm_displaytarget *xm_dt,
struct xlib_drawable *xmb,
unsigned width, unsigned height)
{
+ /* try allocating a shared memory image first */
if (xm_dt->shm) {
alloc_shm_ximage(xm_dt, xmb, width, height);
- return;
+ if (xm_dt->tempImage)
+ return; /* success */
}
+ /* try regular (non-shared memory) image */
xm_dt->tempImage = XCreateImage(xm_dt->display,
xmb->visual,
xmb->depth,
@@ -252,6 +255,10 @@ xm_displaytarget_destroy(struct sw_winsys *ws,
xm_dt->shminfo.shmid = -1;
xm_dt->shminfo.shmaddr = (char *) -1;
+
+ xm_dt->data = NULL;
+ if (xm_dt->tempImage)
+ xm_dt->tempImage->data = NULL;
}
else {
FREE(xm_dt->data);