VLM : Fix a race condition when input event is triggered and vlm_MediaInstanceDelete...
authorSébastien Escudier <sebastien-devel@celeos.eu>
Thu, 8 Oct 2009 08:05:07 +0000 (10:05 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 18 Oct 2009 11:17:13 +0000 (14:17 +0300)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
src/input/vlm.c

index 9440ac2..bc8157f 100644 (file)
@@ -843,6 +843,7 @@ static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instanc
     if( p_instance->p_input_resource )
         input_resource_Delete( p_instance->p_input_resource );
 
+    TAB_REMOVE( p_media->i_instance, p_media->instance, p_instance );
     vlc_gc_decref( p_instance->p_item );
     free( p_instance->psz_name );
     free( p_instance );
@@ -950,7 +951,6 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
 
         if( !p_instance->p_input )
         {
-            TAB_REMOVE( p_media->i_instance, p_media->instance, p_instance );
             vlm_MediaInstanceDelete( p_vlm, id, p_instance, p_media );
         }
         else
@@ -975,8 +975,6 @@ static int vlm_ControlMediaInstanceStop( vlm_t *p_vlm, int64_t id, const char *p
     if( !p_instance )
         return VLC_EGENERIC;
 
-    TAB_REMOVE( p_media->i_instance, p_media->instance, p_instance );
-
     vlm_MediaInstanceDelete( p_vlm, id, p_instance, p_media );
 
     return VLC_SUCCESS;