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.
This commit is contained in:
wm4 committed 2014-01-08 21:49:18 +01:00
1 parent 1d2a111337
commit 34abe7e255
1 file changed
+2 -1
+2 -1
View File
@@ -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, &registry_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)