summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorJeremy Huddleston <[email protected]>2011-06-17 12:28:05 -0700
committerJeremy Huddleston <[email protected]>2011-06-20 16:54:58 -0700
commit517614141be2a1f392a4ea87c1077911ccadf35f (patch)
tree27102b4c9118d7c512b548a099e6da6f97f94af8 /src/glx
parent559e4f8ebcb186b491d7d687ac43f22a62448fc1 (diff)
glx: Destroy the old context only after the new one has been bound
This fixes a regression introduced by 49d7e48b33264d94e30af6129c281b6acafa9427 Signed-off-by: Jeremy Huddleston <[email protected]>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/glxcurrent.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 9eb7d5ac546..0f39ee50737 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -255,13 +255,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
if (--oldGC->thread_refcount == 0) {
oldGC->vtable->unbind(oldGC, gc);
oldGC->currentDpy = 0;
-
- if (oldGC->xid == None && oldGC != gc) {
- /* We are switching away from a context that was
- * previously destroyed, so we need to free the memory
- * for the old handle. */
- oldGC->vtable->destroy(oldGC);
- }
}
}
@@ -279,6 +272,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
__glXSetCurrentContextNull();
}
+ if (oldGC->thread_refcount == 0 && oldGC != &dummyContext && oldGC->xid == None) {
+ /* We are switching away from a context that was
+ * previously destroyed, so we need to free the memory
+ * for the old handle. */
+ oldGC->vtable->destroy(oldGC);
+ }
+
__glXUnlock();
if (ret) {