vo_dmabuf_wayland: init wl_list at the top of preinit

Otherwise, we could fail and skip to uninit without initalizing this
which then will segfault because the list is null and accessed while
trying to destroy buffers.
This commit is contained in:
Dudemanguy 2023-07-02 21:22:07 -05:00
parent a890d7be2a
commit 180a3df1f1
1 changed files with 2 additions and 2 deletions

View File

@ -467,11 +467,11 @@ static int preinit(struct vo *vo)
p->log = vo->log; p->log = vo->log;
p->global = vo->global; p->global = vo->global;
p->ctx = ra_ctx_create_by_name(vo, "wldmabuf"); p->ctx = ra_ctx_create_by_name(vo, "wldmabuf");
wl_list_init(&p->buffer_list);
if (!p->ctx) if (!p->ctx)
goto err; goto err;
assert(p->ctx->ra);
wl_list_init(&p->buffer_list); assert(p->ctx->ra);
if (!vo->wl->dmabuf || !vo->wl->dmabuf_feedback) { if (!vo->wl->dmabuf || !vo->wl->dmabuf_feedback) {
MP_FATAL(vo->wl, "Compositor doesn't support the %s (ver. 4) protocol!\n", MP_FATAL(vo->wl, "Compositor doesn't support the %s (ver. 4) protocol!\n",