]> git.sesse.net Git - vlc/commitdiff
wl_shell_surface: fix dead lock when destroying thread
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 30 Aug 2014 20:33:12 +0000 (23:33 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 30 Aug 2014 20:33:12 +0000 (23:33 +0300)
modules/video_output/Modules.am
modules/video_output/wl/shell_surface.c

index 91ca30444953fcd5e4044335c64520d8258a4775..2031a3ba4c2580f43ab7f64ddf2710f85e11b282 100644 (file)
@@ -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
index f0d4096e8e1780e079cc87f306d891270a074e81..967b520f373f4ec5c0f70d34648c2d41116f6b11 100644 (file)
@@ -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;
 }