[vlc-commits] input/var: fix deletion of seekpoint navigation callbacks

Filip Roséen git at videolan.org
Mon Jul 18 06:24:30 CEST 2016


vlc | branch: master | Filip Roséen <filip at videolabs.io> | Sat Jul 16 22:38:27 2016 +0200| [ee8f0516a22a975e44bec35ea1991b076133fd94] | committer: Jean-Baptiste Kempf

input/var: fix deletion of seekpoint navigation callbacks

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 we would potentially try to remove callbacks from
variables that does not exist.

This fixes the issue by having symmetry between creation of the
callbacks (src/input/var.c:381-397), and deletion of such.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 );
+    }
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list