[vlc-devel] [PATCH 3/4] input/var: fix deletion of seekpoint navigation callbacks

Filip Roséen filip at videolabs.io
Sat Jul 16 22:38:27 CEST 2016


The vlc-variables that will have their callbacks removed through
InputDelCallbacks related to seekpoint-navigation only exists if the
current title has more than one seekpoint.

This means that (prior to this patch), we would potentially try to
remove callbacks from variables that does not exist.

This patch fixes the issue by having symmetry between creation of the
callbacks (src/input/var.c:381-397), and deletion of such.
---
 src/input/var.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/input/var.c b/src/input/var.c
index 9423996..cb54d28 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -227,6 +227,9 @@ void input_ControlVarInit ( input_thread_t *p_input )
  *****************************************************************************/
 void input_ControlVarStop( input_thread_t *p_input )
 {
+    demux_t* p_demux  = p_input->p->master->p_demux;
+    int i_cur_title;
+
     if( !p_input->b_preparsing )
         InputDelCallbacks( p_input, p_input_callbacks );
 
@@ -235,8 +238,6 @@ void input_ControlVarStop( input_thread_t *p_input )
 
     if( p_input->p->i_title > 0 )
     {
-        InputDelCallbacks( p_input, p_input_seekpoint_navigation_callbacks );
-
         for( int i = 0; i < p_input->p->i_title; i++ )
         {
             char name[sizeof("title ") + 3 * sizeof (int)];
@@ -245,6 +246,14 @@ void input_ControlVarStop( input_thread_t *p_input )
             var_DelCallback( p_input, name, NavigationCallback, (void *)(intptr_t)i );
         }
     }
+
+    if( !demux_Control( p_demux, DEMUX_GET_TITLE, &i_cur_title ) )
+    {
+        input_title_t* t = p_input->p->title[ i_cur_title ];
+
+        if( t->i_seekpoint > 1 )
+            InputDelCallbacks( p_input, p_input_seekpoint_navigation_callbacks );
+    }
 }
 
 /*****************************************************************************
-- 
2.9.0



More information about the vlc-devel mailing list