Mesa (mesa_7_6_branch): glx: don't destroy context immediately if it' s currently bound

Brian Paul brianp at kemper.freedesktop.org
Fri Oct 23 00:33:52 UTC 2009


Module: Mesa
Branch: mesa_7_6_branch
Commit: 5e6a6a2719c695996490bde491dac267e52f78af
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e6a6a2719c695996490bde491dac267e52f78af

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Oct 22 18:19:01 2009 -0600

glx: don't destroy context immediately if it's currently bound

According to the GLXDestroyContext() man page, the context should not
immediately be destroyed if it's bound to some thread.  Wait until it's
unbound to really delete it.  The code for doing the later part is
already present in MakeContextCurrent() so no change was needed there.

---

 src/glx/x11/glxcmds.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index cd4aede..c63116b 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -540,6 +540,16 @@ DestroyContext(Display * dpy, GLXContext gc)
    imported = gc->imported;
    gc->xid = None;
 
+   if (gc->currentDpy) {
+      /* This context is bound to some thread.  According to the man page,
+       * we should not actually delete the context until it's unbound.
+       * Note that we set gc->xid = None above.  In MakeContextCurrent()
+       * we check for that and delete the context there.
+       */
+      __glXUnlock();
+      return;
+   }
+
 #ifdef GLX_DIRECT_RENDERING
    /* Destroy the direct rendering context */
    if (gc->driContext) {




More information about the mesa-commit mailing list