[vlc-devel] [PATCH] wayland/shell: Fix race for wnd->display.wl.

Matthias Treydte mt at waldheinz.de
Mon Jan 19 16:24:57 CET 2015


The Wayland background thread dereferences said variable, but is started
before the value is written there. Occasionally the thread would win
the race and segfault in wl_display_get_fd.
---
 modules/video_output/wayland/shell_surface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/wayland/shell_surface.c b/modules/video_output/wayland/shell_surface.c
index 60d0635..013f1b8 100644
--- a/modules/video_output/wayland/shell_surface.c
+++ b/modules/video_output/wayland/shell_surface.c
@@ -351,9 +351,6 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
     //if (var_InheritBool (wnd, "keyboard-events"))
     //    do_something();
 
-    if (vlc_clone (&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
-        goto error;
-
     wl_display_flush(display);
 
     wnd->type = VOUT_WINDOW_TYPE_WAYLAND;
@@ -361,6 +358,9 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
     wnd->display.wl = display;
     wnd->control = Control;
 
+    if (vlc_clone (&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
+        goto error;
+
     vout_window_ReportSize(wnd, cfg->width, cfg->height);
     return VLC_SUCCESS;
 
-- 
2.2.1




More information about the vlc-devel mailing list