summaryrefslogtreecommitdiff
path: root/src/glx/glxcurrent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/glxcurrent.c')
-rw-r--r--src/glx/glxcurrent.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 98f66c2289..710985b02c 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -242,13 +242,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
return False;
}
- if (oldGC != &dummyContext && oldGC != gc) {
+ if (oldGC != &dummyContext) {
oldGC->vtable->unbind(oldGC, gc);
oldGC->currentDpy = 0;
oldGC->currentDrawable = None;
oldGC->currentReadable = None;
oldGC->thread_id = 0;
- if (oldGC->xid == None)
+ 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.
@@ -257,12 +257,12 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
}
if (gc) {
- ret = gc->vtable->bind(gc, oldGC, draw, read);
gc->currentDpy = dpy;
gc->currentDrawable = draw;
gc->currentReadable = read;
gc->thread_id = _glthread_GetID();
__glXSetCurrentContext(gc);
+ ret = gc->vtable->bind(gc, oldGC, draw, read);
} else {
__glXSetCurrentContextNull();
}