Fix deadlock
authorRémi Denis-Courmont <rem@videolan.org>
Mon, 1 Oct 2007 18:00:42 +0000 (18:00 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Mon, 1 Oct 2007 18:00:42 +0000 (18:00 +0000)
src/misc/objects.c

index 606f11f..79a64d2 100644 (file)
@@ -515,12 +515,15 @@ vlc_bool_t __vlc_object_wait( vlc_object_t *obj )
     vlc_assert_locked( &obj->object_lock );
 
     int fd = obj->p_internals->pipes[0];
-    if( ( fd != -1 )
-     && ( read( fd, &(char){ 0 }, 1 ) == 0 ) )
+    if( fd != -1 )
     {
-        close( fd );
-        obj->p_internals->pipes[1] = -1;
-    }   
+        if( read( fd, &(char){ 0 }, 1 ) == 0 )
+        {
+            close( fd );
+            obj->p_internals->pipes[1] = -1;
+        }
+        return obj->b_die;
+    }
 
     vlc_cond_wait( &obj->object_wait, &obj->object_lock );
     return obj->b_die;