[vlc-commits] wl_shell_surface: fix dead lock when destroying thread

Rémi Denis-Courmont git at videolan.org
Sat Aug 30 22:33:49 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 30 23:33:12 2014 +0300| [30d90a49531e89ad4925811e0718b638e655d28a] | committer: Rémi Denis-Courmont

wl_shell_surface: fix dead lock when destroying thread

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

 modules/video_output/Modules.am         |    2 +-
 modules/video_output/wl/shell_surface.c |    9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am
index 91ca304..2031a3b 100644
--- a/modules/video_output/Modules.am
+++ b/modules/video_output/Modules.am
@@ -131,7 +131,7 @@ endif
 ### Wayland ###
 libwl_shell_surface_plugin_la_SOURCES = wl/shell_surface.c
 libwl_shell_surface_plugin_la_CFLAGS = $(WAYLAND_CLIENT_CFLAGS)
-libwl_shell_surface_plugin_la_LIBADD = $(WAYLAND_CLIENT_LIBS)
+libwl_shell_surface_plugin_la_LIBADD = $(WAYLAND_CLIENT_LIBS) $(LIBPTHREAD)
 if HAVE_WAYLAND
 vout_LTLIBRARIES += libwl_shell_surface_plugin.la
 endif
diff --git a/modules/video_output/wl/shell_surface.c b/modules/video_output/wl/shell_surface.c
index f0d4096..967b520 100644
--- a/modules/video_output/wl/shell_surface.c
+++ b/modules/video_output/wl/shell_surface.c
@@ -46,6 +46,13 @@ struct vout_window_sys_t
     vlc_thread_t thread;
 };
 
+static void cleanup_wl_display_read(void *data)
+{
+    struct wl_display *display = data;
+
+    wl_display_cancel_read(display);
+}
+
 /** Background thread for Wayland shell events handling */
 static void *Thread(void *data)
 {
@@ -54,6 +61,7 @@ static void *Thread(void *data)
     struct pollfd ufd[1];
 
     int canc = vlc_savecancel();
+    vlc_cleanup_push(cleanup_wl_display_read, display);
 
     ufd[0].fd = wl_display_get_fd(display);
     ufd[0].events = POLLIN;
@@ -73,6 +81,7 @@ static void *Thread(void *data)
         wl_display_dispatch_pending(display);
     }
     assert(0);
+    vlc_cleanup_pop();
     //vlc_restorecancel(canc);
     //return NULL;
 }



More information about the vlc-commits mailing list