[vlc-commits] input: remove input_LegacyVarStop

Thomas Guillem git at videolan.org
Thu Jul 12 18:49:32 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jul 12 18:27:33 2018 +0200| [4e2718218848e689aa41d13822cd3b0b5ab67c4f] | committer: Thomas Guillem

input: remove input_LegacyVarStop

This code path is way too racy (even before
2ef7696e96f5c55a4801335820c79df7f1a52fd0): input_priv(p_input)->i_title is not
protected and the variables were not cleaned if i_title changed from 1 to 0.

This function was useless anyway since it was always called before
input_Close() that destroyed the input thread object and all variables /
callbacks.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4e2718218848e689aa41d13822cd3b0b5ab67c4f
---

 include/vlc_input.h                  |  1 -
 lib/media_player.c                   |  2 --
 modules/services_discovery/podcast.c |  2 --
 src/input/var.c                      | 36 ------------------------------------
 src/input/vlm.c                      |  4 ----
 src/libvlccore.sym                   |  1 -
 src/playlist/thread.c                |  2 --
 7 files changed, 48 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 2efbbd9561..623fad3aae 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -575,7 +575,6 @@ VLC_API void input_SetPosition( input_thread_t *, float f_position, bool b_fast
 
 VLC_API void input_LegacyEvents(input_thread_t *, void *, const struct vlc_input_event * );
 VLC_API void input_LegacyVarInit ( input_thread_t * );
-VLC_API void input_LegacyVarStop( input_thread_t * );
 
 /**
  * Get the input item for an input thread
diff --git a/lib/media_player.c b/lib/media_player.c
index 9173486ae0..270d3b858d 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -179,7 +179,6 @@ static void release_input_thread( libvlc_media_player_t *p_mi )
     var_DelCallback( p_input_thread, "intf-event",
                      input_event_changed, p_mi );
     del_es_callbacks( p_input_thread, p_mi );
-    input_LegacyVarStop( p_input_thread );
 
     /* We owned this one */
     input_Stop( p_input_thread );
@@ -1013,7 +1012,6 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
         var_DelCallback( p_input_thread, "can-pause", input_pausable_changed, p_mi );
         var_DelCallback( p_input_thread, "program-scrambled", input_scrambled_changed, p_mi );
         var_DelCallback( p_input_thread, "can-seek", input_seekable_changed, p_mi );
-        input_LegacyVarStop( p_input_thread );
         input_Close( p_input_thread );
         media_detach_preparsed_event( p_mi->p_md );
         libvlc_printerr( "Input initialization failure" );
diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c
index b8af6e512f..4ae66669b9 100644
--- a/modules/services_discovery/podcast.c
+++ b/modules/services_discovery/podcast.c
@@ -188,7 +188,6 @@ static void Close( vlc_object_t *p_this )
         if( !p_input )
             continue;
 
-        input_LegacyVarStop( p_input );
         input_Stop( p_input );
         input_Close( p_input );
 
@@ -258,7 +257,6 @@ noreturn static void *Run( void *data )
 
             if( state == END_S || state == ERROR_S )
             {
-                input_LegacyVarStop( p_input );
                 input_Stop( p_input );
                 input_Close( p_input );
 
diff --git a/src/input/var.c b/src/input/var.c
index 9c33d2d295..2dbb8b7df1 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -114,15 +114,6 @@ static const vlc_input_callback_t p_input_callbacks[] =
 
     CALLBACK( NULL, NULL )
 };
-static const vlc_input_callback_t p_input_title_navigation_callbacks[] =
-{
-    CALLBACK( "next-title", TitleCallback ),
-    CALLBACK( "prev-title", TitleCallback ),
-    CALLBACK( "menu-popup", TitleCallback ),
-    CALLBACK( "menu-title", TitleCallback ),
-
-    CALLBACK( NULL, NULL )
-};
 #undef CALLBACK
 
 static void Trigger( input_thread_t *p_input, int i_type )
@@ -530,33 +521,6 @@ void input_LegacyVarInit ( input_thread_t *p_input )
 }
 
 /*****************************************************************************
- * input_LegacyVarStop:
- *****************************************************************************/
-void input_LegacyVarStop( input_thread_t *p_input )
-{
-    if( !input_priv(p_input)->b_preparsing )
-        InputDelCallbacks( p_input, p_input_callbacks );
-
-    if( input_priv(p_input)->i_title > 1 )
-        InputDelCallbacks( p_input, p_input_title_navigation_callbacks );
-
-    for( int i = 0; i < input_priv(p_input)->i_title; i++ )
-    {
-        char name[sizeof("title ") + 3 * sizeof (int)];
-
-        sprintf( name, "title %2u", i );
-        var_DelCallback( p_input, name, NavigationCallback, (void *)(intptr_t)i );
-    }
-
-    if( var_Type( p_input, "next-chapter" ) != 0 )
-    {
-        assert( var_Type( p_input, "prev-chapter" ) != 0 );
-        var_Destroy( p_input, "next-chapter" );
-        var_Destroy( p_input, "prev-chapter" );
-    }
-}
-
-/*****************************************************************************
  * input_LegacyVarNavigation:
  *  Create all remaining control object variables
  *****************************************************************************/
diff --git a/src/input/vlm.c b/src/input/vlm.c
index f1efa7d64f..05d4533a02 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -645,7 +645,6 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
 
                 var_DelCallback( p_input, "intf-event", InputEventPreparse,
                                  &preparse );
-                input_LegacyVarStop( p_input );
 
                 input_Stop( p_input );
                 input_Close( p_input );
@@ -886,7 +885,6 @@ static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instanc
     input_thread_t *p_input = p_instance->p_input;
     if( p_input )
     {
-        input_LegacyVarStop( p_input );
         input_Stop( p_input );
         input_Close( p_input );
 
@@ -975,7 +973,6 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
             return VLC_SUCCESS;
         }
 
-        input_LegacyVarStop( p_input );
         input_Stop( p_input );
         input_Close( p_input );
 
@@ -1013,7 +1010,6 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
             if( input_Start( p_instance->p_input ) != VLC_SUCCESS )
             {
                 var_DelCallback( p_instance->p_input, "intf-event", InputEvent, p_media );
-                input_LegacyVarStop( p_instance->p_input );
                 input_Close( p_instance->p_input );
                 p_instance->p_input = NULL;
             }
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index ec43e57124..aa60639a82 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -209,7 +209,6 @@ input_vaControl
 input_SetTime
 input_SetPosition
 input_LegacyVarInit
-input_LegacyVarStop
 input_LegacyEvents
 vlc_readdir_helper_init
 vlc_readdir_helper_finish
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index 0aa539baf1..b072d72198 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -231,7 +231,6 @@ static bool PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
         {
             var_DelCallback( p_input_thread, "intf-event",
                              InputEvent, p_playlist );
-            input_LegacyVarStop( p_input_thread );
             vlc_object_release( p_input_thread );
             p_input_thread = NULL;
         }
@@ -456,7 +455,6 @@ static void LoopInput( playlist_t *p_playlist )
     if( !var_InheritBool( p_input, "sout-keep" ) )
         input_resource_TerminateSout( p_sys->p_input_resource );
     var_DelCallback( p_input, "intf-event", InputEvent, p_playlist );
-    input_LegacyVarStop( p_input );
     input_Close( p_input );
     PL_LOCK;
 }



More information about the vlc-commits mailing list