Skip to content

Commit a58dd8a

Browse files
na-na-hisfan5
authored andcommitted
video/out/opengl/context_wayland: cleanup vo when egl fails to init
When the "new" API for OpenGL VO backends was created 10 years ago in df97c30, it was expected that any "driver" that fails to init to clean up themselves (the "old" API always called mpgl_uninit() to clean up on failure). However, when switching Wayland to the "new" API, this was forgotten. Wayland VO will never be cleaned up when EGL init fails. With commit a310a65, this issue was exposed when a leftover Wayland context pointer, which results from a successful Wayland context init but with failed EGL init, triggers an assertion in the X11 context init code, which expects the pointer to be NULL. Fix this by uninit Wayland context when EGL init fails. Fixes: bd87598
1 parent d15f34b commit a58dd8a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎video/out/opengl/context_wayland.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,10 @@ static void wayland_egl_update_render_opts(struct ra_ctx *ctx)
214214

215215
static bool wayland_egl_init(struct ra_ctx *ctx)
216216
{
217-
if (!vo_wayland_init(ctx->vo))
218-
return false;
219-
return egl_create_context(ctx);
217+
if (vo_wayland_init(ctx->vo) && egl_create_context(ctx))
218+
return true;
219+
vo_wayland_uninit(ctx->vo);
220+
return false;
220221
}
221222

222223
const struct ra_ctx_fns ra_ctx_wayland_egl = {

0 commit comments

Comments
 (0)