]> git.sesse.net Git - vlc/commitdiff
interaction: safely join the thread
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 5 Jul 2008 12:04:10 +0000 (15:04 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 5 Jul 2008 12:04:29 +0000 (15:04 +0300)
src/interface/interaction.c
src/interface/interface.h
src/libvlc.c

index 59a4f0f5eb600107ec27d1491df2f0e8d7c38712..6eab001827b4cff34d3edcbedf960dc8527f7f5c 100644 (file)
@@ -388,6 +388,16 @@ interaction_t * interaction_Init( libvlc_int_t *p_libvlc )
     return p_interaction;
 }
 
+void interaction_Destroy( interaction_t *p_interaction )
+{
+    if( !p_interaction )
+        return;
+
+    vlc_object_kill( p_interaction );
+    vlc_thread_join( p_interaction );
+    vlc_object_release( p_interaction );
+}
+
 /**********************************************************************
  * The following functions are local
  **********************************************************************/
index 82530d9aaad4ba3ef51d4a5c3a1b666512a76f45..6401ccdd7f7db99a1c64473f5f4c0544f14e2c38 100644 (file)
@@ -34,7 +34,7 @@
  * Interaction
  **********************************************************************/
 
-/* release via vlc_object_release() */
 interaction_t * interaction_Init( libvlc_int_t *p_libvlc );
+void interaction_Destroy( interaction_t * );
 
 #endif
index 1e62c1fdf1645a8acc2d0847069bf8c4d1bd2058..73eed932703d63f3eb3d0d9c91de6b35af56debd 100644 (file)
@@ -964,7 +964,7 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
 
     /* Free interaction */
     msg_Dbg( p_libvlc, "removing interaction" );
-    vlc_object_release( priv->p_interaction );
+    interaction_Destroy( priv->p_interaction );
 
     /* Free video outputs */
     msg_Dbg( p_libvlc, "removing all video outputs" );