From 34abe7e2555d1478ea94a2e762a6e7820dd59b28 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 8 Jan 2014 21:49:18 +0100 Subject: 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. --- video/out/wayland_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'video') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 82fe412f79..d3fbd8eadf 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -750,7 +750,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, ®istry_listener, wl); @@ -896,6 +895,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) -- cgit v1.2.3