[vlc-devel] [PATCH v2] egl_pbuffer: add missing call to eglTerminate()

Alexandre Janniaux ajanni at videolabs.io
Mon Mar 22 15:02:37 UTC 2021


Merged! Thank you for the changes and sorry for the
inconvenient roundtrips!

Regards,
--
Alexandre Janniaux
Videolabs

On Mon, Mar 22, 2021 at 03:00:05PM +0100, Romain Vimont wrote:
> 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.
> ---
>  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);
>
> --
> 2.31.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list