summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2010-07-23 22:05:21 -0400
committerKristian Høgsberg <[email protected]>2010-07-23 22:05:53 -0400
commitd77bb8e059ecfed9b714301fc31b093c6026c7bc (patch)
treebf201f09f5f253cb5adeea6e6df581bb9b89f251
parent6739d52fdced53a566188215d204ffef1e85a5e6 (diff)
glx: Don't destroy context with XID 0
We use XID 0 to indicate the context has already been destroyed, but it's currently bound.
-rw-r--r--src/glx/dri2_glx.c3
-rw-r--r--src/glx/dri_glx.c3
-rw-r--r--src/glx/drisw_glx.c3
-rw-r--r--src/glx/glxcmds.c4
4 files changed, 9 insertions, 4 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 4a08f84de3c..a94223b2a12 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -119,7 +119,8 @@ dri2_destroy_context(__GLXcontext *context)
struct dri2_context *pcp = (struct dri2_context *) context;
struct dri2_screen *psc = (struct dri2_screen *) context->psc;
- glx_send_destroy_context(psc->base.dpy, context->xid);
+ if (context->xid)
+ glx_send_destroy_context(psc->base.dpy, context->xid);
if (context->extensions)
XFree((char *) context->extensions);
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index d0f680de636..eaf8e3b7f25 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -505,7 +505,8 @@ dri_destroy_context(__GLXcontext * context)
struct dri_context *pcp = (struct dri_context *) context;
struct dri_screen *psc = (struct dri_screen *) context->psc;
- glx_send_destroy_context(psc->base.dpy, context->xid);
+ if (context->xid)
+ glx_send_destroy_context(psc->base.dpy, context->xid);
if (context->extensions)
XFree((char *) context->extensions);
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 852e56e484e..11f88e96703 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -245,7 +245,8 @@ drisw_destroy_context(__GLXcontext *context)
struct drisw_context *pcp = (struct drisw_context *) context;
struct drisw_screen *psc = (struct drisw_screen *) context->psc;
- glx_send_destroy_context(psc->base.dpy, context->xid);
+ if (context->xid)
+ glx_send_destroy_context(psc->base.dpy, context->xid);
if (context->extensions)
XFree((char *) context->extensions);
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 1ded6247ef3..b92638c9c22 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -584,7 +584,7 @@ glx_send_destroy_context(Display *dpy, XID xid)
static void
indirect_destroy_context(__GLXcontext *gc)
{
- if (!gc->imported)
+ if (!gc->imported && gc->xid)
glx_send_destroy_context(gc->psc->dpy, gc->xid);
__glXFreeVertexArrayState(gc);
@@ -619,6 +619,8 @@ DestroyContext(Display * dpy, GLXContext gc)
* Note that we set gc->xid = None above. In MakeContextCurrent()
* we check for that and delete the context there.
*/
+ if (!gc->imported)
+ glx_send_destroy_context(dpy, gc->xid);
gc->xid = None;
__glXUnlock();
return;