mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 23:40:10 +01:00
egl: Fix leaks in eglReleaseThread.
There may be multiple bound contexts that should be unbound.
This commit is contained in:
parent
7c09296d4c
commit
11cf3cb2c4
1 changed files with 13 additions and 6 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue