egl: Correctly unbind contexts in eglReleaseThread.
authorChia-I Wu <olvaffe@gmail.com>
Thu, 28 Jan 2010 08:49:40 +0000 (16:49 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Thu, 28 Jan 2010 09:28:48 +0000 (17:28 +0800)
MakeCurrent unbinds the current context of the current API.  Modify the
current API to make sure all contexts are correctly unbound.

src/egl/main/eglapi.c

index d0f9749f84f553e6d090b55fcd9ef95dc5cdede6..7e77ef1f038e40fb6404619ac0d47ecf73aecd96 100644 (file)
@@ -997,6 +997,7 @@ eglReleaseThread(void)
    /* unbind current contexts */
    if (!_eglIsCurrentThreadDummy()) {
       _EGLThreadInfo *t = _eglGetCurrentThread();
+      EGLint api_index = t->CurrentAPIIndex;
       EGLint i;
 
       for (i = 0; i < _EGL_API_NUM_APIS; i++) {
@@ -1004,9 +1005,12 @@ eglReleaseThread(void)
          if (ctx) {
             _EGLDisplay *disp = ctx->Resource.Display;
             _EGLDriver *drv = disp->Driver;
+            t->CurrentAPIIndex = i;
             (void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL);
          }
       }
+
+      t->CurrentAPIIndex = api_index;
    }
 
    _eglDestroyCurrentThread();