]> git.sesse.net Git - vlc/commitdiff
interface: Make sure the MonitorLibVLCDeath thread exit.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 5 Jul 2008 10:56:23 +0000 (12:56 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 5 Jul 2008 10:57:34 +0000 (12:57 +0200)
src/interface/interface.c

index 5de0c7122fcdd189bb5509e969aef93379009f46..51a62a59e651ef99bef21ef9b7c24e3a28e8a2f6 100644 (file)
@@ -147,6 +147,13 @@ int intf_RunThread( intf_thread_t *p_intf )
             return VLC_EGENERIC;
         }
         RunInterface( p_intf );
+
+        /* Make sure our MonitorLibVLCDeath thread exit */
+        vlc_object_kill( p_intf );
+        /* It is monitoring libvlc, not the p_intf */
+        vlc_object_signal( p_intf->p_libvlc );
+        vlc_thread_join( p_intf );
+
         vlc_object_detach( p_intf );
         vlc_object_release( p_intf );
         return VLC_SUCCESS;
@@ -255,7 +262,14 @@ static void MonitorLibVLCDeath( intf_thread_t *p_intf )
     libvlc_int_t * p_libvlc = p_intf->p_libvlc;
     vlc_object_lock( p_libvlc );
     while(vlc_object_alive( p_libvlc ) )
+    {
+        if(p_intf->b_die)
+        {
+            vlc_object_unlock( p_libvlc );
+            return;
+        }
         vlc_object_wait( p_libvlc );
+    }
     vlc_object_unlock( p_libvlc );
 
     /* Someone killed libvlc */