Commit ee8f0516 authored by Filip Roséen's avatar Filip Roséen Committed by 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's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3f66ca77
......@@ -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 );
}
}
/*****************************************************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment