Changeset d10dffca3516b7650fa79c94947bfd18ac6a6fa0

Show
Ignore:
Timestamp:
07/05/08 13:34:26 (2 months ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1215257666 +0000
git-parent:

[b8961d693f68502c83e085db25f1d4903594519a]

git-author:
Laurent Aimar <fenrir@videolan.org> 1215257633 +0000
Message:

Fixed input_StopThread by really killing all input children (even
grandchildren)
It fixes when access-filter is used or when a demuxer instanciates sub
access/stream/demuxer

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/input/input.c

    r8d65a75 rd10dffc  
    435435 * \param the input thread to stop 
    436436 */ 
    437 void input_StopThread( input_thread_t *p_input
     437static void ObjectKillChildrens( vlc_object_t *p_obj
    438438{ 
    439439    vlc_list_t *p_list; 
    440440    int i; 
    441  
    442     /* Set die for input */ 
    443     vlc_object_kill( p_input ); 
    444     /* FIXME: seems to be duplicated in ControlPush(INPUT_CONTROL_SET_DIE) */ 
    445  
    446     /* We cannot touch p_input fields directly (we come from another thread), 
    447      * so use the vlc_object_find way, it's perfectly safe */ 
    448  
    449     /* Set die for all access, stream, demux, etc */ 
    450     p_list = vlc_list_children( p_input ); 
     441    vlc_object_kill( p_obj ); 
     442 
     443    p_list = vlc_list_children( p_obj ); 
    451444    for( i = 0; i < p_list->i_count; i++ ) 
    452         vlc_object_kill( p_list->p_values[i].p_object ); 
     445        ObjectKillChildrens( p_list->p_values[i].p_object ); 
    453446    vlc_list_release( p_list ); 
     447} 
     448void input_StopThread( input_thread_t *p_input ) 
     449{ 
     450    vlc_list_t *p_list; 
     451    int i; 
     452 
     453    /* Set die for input and ALL of this childrens (even (grand-)grand-childrens) 
     454     * It is needed here even if it is done in INPUT_CONTROL_SET_DIE handler to 
     455     * unlock the control loop */ 
     456    ObjectKillChildrens( VLC_OBJECT(p_input) ); 
    454457 
    455458    input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL ); 
     
    14261429        case INPUT_CONTROL_SET_DIE: 
    14271430            msg_Dbg( p_input, "control: stopping input" ); 
     1431 
    14281432            /* Mark all submodules to die */ 
    1429             if( p_input->p->input.p_access ) 
    1430                 vlc_object_kill( p_input->p->input.p_access ); 
    1431             if( p_input->p->input.p_stream ) 
    1432                 vlc_object_kill( p_input->p->input.p_stream ); 
    1433             vlc_object_kill( p_input->p->input.p_demux ); 
    1434  
    1435             vlc_object_kill( p_input ); 
     1433            ObjectKillChildrens( p_input ); 
    14361434            break; 
    14371435