Commit 3c2c9364 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Handle NULL value in "input-current" callback

parent ad30beea
......@@ -508,8 +508,12 @@ static int PlaylistEvent( vlc_object_t *p_this, char const *psz_var,
(void) p_this; (void) psz_var; (void) oldval;
var_AddCallback( p_input, "intf-event", InputEvent, p_intf );
assert( p_sys->p_input == NULL );
p_sys->p_input = vlc_object_hold( p_input );
if( p_input != NULL )
{
var_AddCallback( p_input, "intf-event", InputEvent, p_intf );
p_sys->p_input = vlc_object_hold( p_input );
}
return VLC_SUCCESS;
}
......@@ -289,17 +289,21 @@ static int PlaylistEvent(vlc_object_t *object, char const *cmd,
VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(object);
intf_thread_t *intf = data;
intf_sys_t *sys = intf->p_sys;
input_thread_t *input = newval.p_address;
assert(sys->input == NULL);
sys->input = vlc_object_hold(input);
if (vlc_clone(&sys->thread, sys->is_master ? Master : Slave, intf,
VLC_THREAD_PRIORITY_INPUT)) {
vlc_object_release(input);
sys->input = NULL;
return VLC_SUCCESS;
if (input != NULL)
{
sys->input = vlc_object_hold(input);
if (vlc_clone(&sys->thread, sys->is_master ? Master : Slave, intf,
VLC_THREAD_PRIORITY_INPUT)) {
vlc_object_release(input);
sys->input = NULL;
return VLC_SUCCESS;
}
var_AddCallback(input, "intf-event", InputEvent, intf);
}
var_AddCallback(input, "intf-event", InputEvent, intf);
return VLC_SUCCESS;
}
......@@ -227,11 +227,13 @@ int VlcProc::onInputNew( vlc_object_t *pObj, const char *pVariable,
VlcProc *pThis = (VlcProc*)pParam;
input_thread_t *pInput = static_cast<input_thread_t*>(newval.p_address);
var_AddCallback( pInput, "intf-event", onGenericCallback2, pThis );
var_AddCallback( pInput, "bit-rate", onGenericCallback, pThis );
var_AddCallback( pInput, "sample-rate", onGenericCallback, pThis );
var_AddCallback( pInput, "can-record", onGenericCallback, pThis );
if( pInput != NULL )
{
var_AddCallback( pInput, "intf-event", onGenericCallback2, pThis );
var_AddCallback( pInput, "bit-rate", onGenericCallback, pThis );
var_AddCallback( pInput, "sample-rate", onGenericCallback, pThis );
var_AddCallback( pInput, "can-record", onGenericCallback, pThis );
}
return VLC_SUCCESS;
}
......
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