[vlc-commits] egl_pbuffer: add missing call to eglTerminate()

Romain Vimont git at videolan.org
Mon Mar 22 14:54:34 UTC 2021


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Mon Mar 22 15:00:05 2021 +0100| [a51ba24aa6b9d5e8864cd6420357091fbd663ed1] | committer: Alexandre Janniaux

egl_pbuffer: add missing call to eglTerminate()

The function eglInitialize() was called on open, but eglTerminate() was
not called on close or error.

Also remove a wrong call to vlc_object_delete(sys->gl) on error, the
vlc_gl_t is not owned by the module.

Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a51ba24aa6b9d5e8864cd6420357091fbd663ed1
---

 modules/video_filter/egl_pbuffer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/egl_pbuffer.c b/modules/video_filter/egl_pbuffer.c
index 0ecc2562d0..3774cf3a0b 100644
--- a/modules/video_filter/egl_pbuffer.c
+++ b/modules/video_filter/egl_pbuffer.c
@@ -138,7 +138,7 @@ static int InitEGL(vlc_gl_t *gl, unsigned width, unsigned height)
     /* Initialize EGL display */
     EGLint major, minor;
     if (eglInitialize(sys->display, &major, &minor) != EGL_TRUE)
-        goto error;
+        return VLC_EGENERIC;
     msg_Dbg(gl, "EGL version %s by %s, API %s",
             eglQueryString(sys->display, EGL_VERSION),
             eglQueryString(sys->display, EGL_VENDOR),
@@ -223,6 +223,7 @@ static int InitEGL(vlc_gl_t *gl, unsigned width, unsigned height)
 
     return VLC_SUCCESS;
 error:
+    eglTerminate(sys->display);
     return VLC_EGENERIC;
 }
 
@@ -352,6 +353,8 @@ static void Close( vlc_gl_t *gl )
     vt->DeleteFramebuffers(BUFFER_COUNT, sys->framebuffers);
     vt->DeleteTextures(BUFFER_COUNT, sys->textures);
     vlc_gl_ReleaseCurrent(sys->gl);
+
+    eglTerminate(sys->display);
 }
 
 static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
@@ -446,7 +449,7 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
     return VLC_SUCCESS;
 
 error2:
-    vlc_object_delete(sys->gl);
+    eglTerminate(sys->display);
 error1:
     vlc_obj_free(&gl->obj, sys);
 



More information about the vlc-commits mailing list