oldGC->currentDrawable = None;
oldGC->currentReadable = None;
oldGC->thread_id = 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);
}
if (gc) {
__glXSetCurrentContextNull();
}
+ if (oldGC != &dummyContext && 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);
+ }
+
if (ret) {
__glXGenerateError(dpy, gc, None, ret, X_GLXMakeContextCurrent);
return GL_FALSE;