]> git.sesse.net Git - vlc/commitdiff
mediacontrol_audio_video.c: release vout in mediacontrol_snapshot()
authorOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Thu, 23 Feb 2006 16:21:56 +0000 (16:21 +0000)
committerOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Thu, 23 Feb 2006 16:21:56 +0000 (16:21 +0000)
src/control/mediacontrol_audio_video.c

index 1a9cb85b5e8242abc3e2f4cbbb14e55ecb2916c3..99af4d8f3d05c4f761fed4547737c9da143af42d 100644 (file)
@@ -67,28 +67,28 @@ mediacontrol_snapshot( mediacontrol_Instance *self,
 
     exception=mediacontrol_exception_init( exception );
 
+    p_vout = vlc_object_find( self->p_playlist, VLC_OBJECT_VOUT, FIND_CHILD );
+    if( ! p_vout )
+    {
+        RAISE( mediacontrol_InternalException, "No video output" );
+        return NULL;
+    }
     p_cache = vlc_object_create( self->p_playlist, VLC_OBJECT_GENERIC );
     if( p_cache == NULL )
     {
+        vlc_object_release( p_vout );
         msg_Err( self->p_playlist, "out of memory" );
         RAISE( mediacontrol_InternalException, "Out of memory" );
         return NULL;
     }
-
-    p_vout = vlc_object_find( self->p_playlist, VLC_OBJECT_VOUT, FIND_CHILD );
-    if( ! p_vout )
-    {
-        RAISE( mediacontrol_InternalException, "No video output" );
-        return NULL;
-    }
     snprintf( path, 255, "object:%d", p_cache->i_object_id );
     var_SetString( p_vout, "snapshot-path", path );
     var_SetString( p_vout, "snapshot-format", "png" );
 
     vlc_mutex_lock( &p_cache->object_lock );
     vout_Control( p_vout, VOUT_SNAPSHOT );
-
     vlc_cond_wait( &p_cache->object_wait, &p_cache->object_lock );
+    vlc_object_release( p_vout );
 
     p_snapshot = ( snapshot_t* ) p_cache->p_private;
     vlc_object_destroy( p_cache );