summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-06-08 02:14:55 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-06-08 02:14:55 +0000
commita0b5c983645e672b6c86d2bd52764ad58fda5d70 (patch)
tree5499bfe1fef142d7d3da49340557eb6efa7f8368
parent31d0cedd788d31915c81a2fd57b34befc7202f51 (diff)
check for double-buffered buffer in XMesaDestroyBuffer() (Dave Reveman)
-rw-r--r--src/mesa/drivers/x11/xm_api.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index d902db0e3e..f710a29866 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1999,24 +1999,27 @@ void XMesaDestroyBuffer( XMesaBuffer b )
if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc );
if (b->swapgc) XMesaFreeGC( b->xm_visual->display, b->swapgc );
- if (b->backxrb->ximage) {
+ if (b->xm_visual->mesa_visual.doubleBufferMode)
+ {
+ if (b->backxrb->ximage) {
#if defined(USE_XSHM) && !defined(XFree86Server)
- if (b->shm) {
- XShmDetach( b->xm_visual->display, &b->shminfo );
- XDestroyImage( b->backxrb->ximage );
- shmdt( b->shminfo.shmaddr );
- }
- else
+ if (b->shm) {
+ XShmDetach( b->xm_visual->display, &b->shminfo );
+ XDestroyImage( b->backxrb->ximage );
+ shmdt( b->shminfo.shmaddr );
+ }
+ else
#endif
- XMesaDestroyImage( b->backxrb->ximage );
- }
- if (b->backxrb->pixmap) {
- XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap );
- if (b->xm_visual->hpcr_clear_flag) {
- XMesaFreePixmap( b->xm_visual->display,
- b->xm_visual->hpcr_clear_pixmap );
- XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage );
- }
+ XMesaDestroyImage( b->backxrb->ximage );
+ }
+ if (b->backxrb->pixmap) {
+ XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap );
+ if (b->xm_visual->hpcr_clear_flag) {
+ XMesaFreePixmap( b->xm_visual->display,
+ b->xm_visual->hpcr_clear_pixmap );
+ XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage );
+ }
+ }
}
if (b->rowimage) {
_mesa_free( b->rowimage->data );
@@ -2634,7 +2637,7 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y,
*/
void XMesaResizeBuffers( XMesaBuffer b )
{
-#if OLD_RENDERBUFFER && 0
+#if OLD_RENDERBUFFER
xmesa_resize_buffers(ctx, &(b->mesa_buffer), 0, 0 );
#endif
}