]> git.sesse.net Git - vlc/commitdiff
control/media_instance.c: Fix the dead lock reported by Olivier Aubert.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 10 Jul 2007 18:56:44 +0000 (18:56 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 10 Jul 2007 18:56:44 +0000 (18:56 +0000)
src/control/media_instance.c

index 9e0b157240e32f0967d88177920b3b879b0d78d8..d6ac34bba2e2f1b8c142e06b76494af3f96fe15d 100644 (file)
@@ -231,11 +231,15 @@ void libvlc_media_instance_release( libvlc_media_instance_t *p_mi )
     vlc_mutex_lock( &p_mi->object_lock );
     
     p_mi->i_refcount--;
+
+    /* We hold the mutex, as a waiter to make sure pending operations
+     * are finished. We can't hold it longer as the get_input_thread
+     * function holds a lock.  */
+
+    vlc_mutex_unlock( &p_mi->object_lock );
+    
     if( p_mi->i_refcount > 0 )
-    {
-        vlc_mutex_unlock( &p_mi->object_lock );
         return;
-    }
 
     release_input_thread( p_mi );