summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11/xm_api.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-08-31 04:30:14 +0000
committerBrian Paul <[email protected]>2001-08-31 04:30:14 +0000
commit9bed64cbf193e87e0dba46edf5cfaec267b0d8e6 (patch)
treec3e06f1dee51b0bf3611c6f81435df88598dcaba /src/mesa/drivers/x11/xm_api.c
parent04ec0fd71e3ba758e0ddc950ec68c3af4c58b1ab (diff)
fixed dangling pointer problem (Chris Burghart)
Diffstat (limited to 'src/mesa/drivers/x11/xm_api.c')
-rw-r--r--src/mesa/drivers/x11/xm_api.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index a077749d597..f80a7a70bde 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1,4 +1,4 @@
-/* $Id: xm_api.c,v 1.26 2001/08/28 22:46:22 brianp Exp $ */
+/* $Id: xm_api.c,v 1.27 2001/08/31 04:30:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -2032,6 +2032,10 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
if (drawBuffer->FXctx) {
fxMesaMakeCurrent(drawBuffer->FXctx);
+ /* Disassociate drawBuffer's current context from drawBuffer */
+ if (drawBuffer->xm_context)
+ drawBuffer->xm_context->xm_buffer = NULL;
+
/* Disassociate old buffer from this context */
if (c->xm_buffer)
c->xm_buffer->xm_context = NULL;
@@ -2054,9 +2058,14 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
return GL_TRUE;
}
+ /* Disassociate drawBuffer's current context from drawBuffer */
+ if (drawBuffer->xm_context)
+ drawBuffer->xm_context->xm_buffer = NULL;
+
/* Disassociate old buffer with this context */
if (c->xm_buffer)
c->xm_buffer->xm_context = NULL;
+
drawBuffer->xm_context = c; /* Associate the context with this buffer */
c->xm_buffer = drawBuffer;