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

Matthias Treydte git at videolan.org
Tue Jan 20 06:45:18 CET 2015


vlc | branch: master | Matthias Treydte <mt at waldheinz.de> | Mon Jan 19 16:24:57 2015 +0100| [a217626ed1053bb488680dc7487ec14cef834609] | committer: Rémi Denis-Courmont

wayland/shell: Fix race for wnd->display.wl.

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.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a217626ed1053bb488680dc7487ec14cef834609
---

 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;
 



More information about the vlc-commits mailing list