diff options
author | Chia-I Wu <[email protected]> | 2010-01-26 17:22:21 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-01-26 18:46:05 +0800 |
commit | 11cf3cb2c463cf8af8a7e63eb9521979bfd303f8 (patch) | |
tree | 6c5dd812f49e5f068e6a2ff4d5ac4bcfbdf4ac82 /src/egl/main/eglapi.c | |
parent | 7c09296d4ce977f711f36c3393fd1a2718a6a6ce (diff) |
egl: Fix leaks in eglReleaseThread.
There may be multiple bound contexts that should be unbound.
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r-- | src/egl/main/eglapi.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index c197cfd38f4..2e5027a32e6 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -984,13 +984,20 @@ eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLBoolean eglReleaseThread(void) { - /* unbind current context */ + /* unbind current contexts */ if (!_eglIsCurrentThreadDummy()) { - _EGLDisplay *disp = _eglGetCurrentDisplay(); - _EGLDriver *drv; - if (disp) { - drv = disp->Driver; - (void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL); + _EGLThreadInfo *t = _eglGetCurrentThread(); + EGLint i; + + for (i = 0; i < _EGL_API_NUM_APIS; i++) { + _EGLContext *ctx = t->CurrentContexts[i]; + if (ctx) { + _EGLDisplay *disp = ctx->Resource.Display; + _EGLDriver *drv = disp->Driver; + /* what if drv is not avaialbe? */ + if (drv) + (void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL); + } } } |