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

Input: attach before any variable access so that inheritance works

So far, the input was attached after it inherited quite a bunch of
variables. This did not quite work. The problem lies in the dual use
of object attachment: variables inheritance and tree search.

Nowadays, the input object should not be looked for before it is
initialized. Only children objects use vlc_object_find anymore, and
they can only exist while the input is fully initialized. Other code
paths use playlist_CurrentInput() or such, which only ever return an
already initialized input (from input.c:Create()).

(N.B.: I wonder if there aren't similar issues in VOUT and AOUT)
parent 4d6f12af
......@@ -312,6 +312,8 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
if( p_input == NULL )
return NULL;
vlc_object_attach( p_input, p_parent );
/* Construct a nice name for the input timer */
char psz_timer_name[255];
char * psz_name = input_item_GetName( p_item );
......@@ -478,9 +480,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
/* Set the destructor when we are sure we are initialized */
vlc_object_set_destructor( p_input, (vlc_destructor_t)Destructor );
/* Attach only once we are ready */
vlc_object_attach( p_input, p_parent );
return p_input;
}
......
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