summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-08 21:49:18 +0100
committerwm4 <wm4@nowhere>2014-01-15 20:51:32 +0100
commitd141d281ca3988c63d0c7a573696626a83f1565e (patch)
tree87f47f514e12d1939341d4e670cc62839c932ffd
parentebc3d74b040790e5154ffb8f45a456e6e79679aa (diff)
downloadmpv-d141d281ca3988c63d0c7a573696626a83f1565e.tar.bz2
mpv-d141d281ca3988c63d0c7a573696626a83f1565e.tar.xz
wayland: fix crash when initialization fails
On X11, if no wayland compositor is running, wl_list_init() will never be called. This will cause destroy_display() to segfault when trying to iterate over the list.
-rw-r--r--video/out/wayland_common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index c553533ec2..616a9cc888 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -646,7 +646,6 @@ static bool create_display (struct vo_wayland_state *wl)
wl_display_add_listener(wl->display.display, &display_listener, wl);
- wl_list_init(&wl->display.output_list);
wl->display.registry = wl_display_get_registry(wl->display.display);
wl_registry_add_listener(wl->display.registry, &registry_listener, wl);
@@ -785,6 +784,8 @@ int vo_wayland_init (struct vo *vo)
wl->vo = vo;
wl->log = mp_log_new(wl, vo->log, "wayland");
+ wl_list_init(&wl->display.output_list);
+
if (!create_input(wl)
|| !create_display(wl)
|| !create_window(wl)