]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/clone.c
Fixed filters implemented as vout (Init/End can be called multiple times
[vlc] / modules / video_filter / clone.c
index 3b558d3b1825731414f3fe57200a6bac419e8970..368f7d5b8b58403847e94b448fa5997a1ba20e1a 100644 (file)
@@ -285,12 +285,16 @@ static void End( vout_thread_t *p_vout )
 {
     int i_index;
 
+    DEL_PARENT_CALLBACKS( SendEventsToChild );
+
     /* Free the fake output buffers we allocated */
     for( i_index = I_OUTPUTPICTURES ; i_index ; )
     {
         i_index--;
         free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
     }
+
+    RemoveAllVout( p_vout );
 }
 
 /*****************************************************************************
@@ -302,10 +306,6 @@ static void Destroy( vlc_object_t *p_this )
 {
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
 
-    RemoveAllVout( p_vout );
-
-    DEL_PARENT_CALLBACKS( SendEventsToChild );
-
     free( p_vout->p_sys->pp_vout );
     free( p_vout->p_sys );
 }
@@ -387,8 +387,7 @@ static void RemoveAllVout( vout_thread_t *p_vout )
          --p_vout->p_sys->i_clones;
          DEL_CALLBACKS( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones],
                         SendEvents );
-         vlc_object_detach( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] );
-         vlc_object_release( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] );
+         vout_Destroy( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] );
     }
 }