diff options
author | Dudemanguy <random342@airmail.cc> | 2023-01-08 12:34:21 -0600 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-01-24 16:39:33 +0100 |
commit | c5e4d65e714ab4246d75c72903d1720fda730d93 (patch) | |
tree | fd13cd5551d302021c705cd368d05a07ef0e5e8b | |
parent | 9f6e1b3ba18c2314d13b8ed763cf1a3a2f60fcd5 (diff) | |
download | mpv-c5e4d65e714ab4246d75c72903d1720fda730d93.tar.bz2 mpv-c5e4d65e714ab4246d75c72903d1720fda730d93.tar.xz |
vo_wlshm: cleanup on failure
If failure occurs during preinit, vo_wlshm should goto an error and
cleaup itself like the other VOs.
-rw-r--r-- | video/out/vo_wlshm.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/video/out/vo_wlshm.c b/video/out/vo_wlshm.c index fc9fc705fc..e3e6f647a0 100644 --- a/video/out/vo_wlshm.c +++ b/video/out/vo_wlshm.c @@ -128,22 +128,38 @@ error0: return NULL; } +static void uninit(struct vo *vo) +{ + struct priv *p = vo->priv; + struct buffer *buf; + + while (p->free_buffers) { + buf = p->free_buffers; + p->free_buffers = buf->next; + talloc_free(buf); + } + vo_wayland_uninit(vo); +} + static int preinit(struct vo *vo) { struct priv *p = vo->priv; if (!vo_wayland_init(vo)) - return -1; + goto err; if (!vo->wl->shm) { MP_FATAL(vo->wl, "Compositor doesn't support the %s protocol!\n", wl_shm_interface.name); - return -1; + goto err; } p->sws = mp_sws_alloc(vo); p->sws->log = vo->log; mp_sws_enable_cmdline_opts(p->sws, vo->global); return 0; +err: + uninit(vo); + return -1; } static int query_format(struct vo *vo, int format) @@ -278,19 +294,6 @@ static void get_vsync(struct vo *vo, struct vo_vsync_info *info) present_sync_get_info(wl->present, info); } -static void uninit(struct vo *vo) -{ - struct priv *p = vo->priv; - struct buffer *buf; - - while (p->free_buffers) { - buf = p->free_buffers; - p->free_buffers = buf->next; - talloc_free(buf); - } - vo_wayland_uninit(vo); -} - const struct vo_driver video_out_wlshm = { .description = "Wayland SHM video output (software scaling)", .name = "wlshm", |