Changeset d10dffca3516b7650fa79c94947bfd18ac6a6fa0
- 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
| r8d65a75 |
rd10dffc |
|
| 435 | 435 | * \param the input thread to stop |
|---|
| 436 | 436 | */ |
|---|
| 437 | | void input_StopThread( input_thread_t *p_input ) |
|---|
| | 437 | static void ObjectKillChildrens( vlc_object_t *p_obj ) |
|---|
| 438 | 438 | { |
|---|
| 439 | 439 | vlc_list_t *p_list; |
|---|
| 440 | 440 | 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 ); |
|---|
| 451 | 444 | 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 ); |
|---|
| 453 | 446 | vlc_list_release( p_list ); |
|---|
| | 447 | } |
|---|
| | 448 | void 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) ); |
|---|
| 454 | 457 | |
|---|
| 455 | 458 | input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL ); |
|---|
| … | … | |
| 1426 | 1429 | case INPUT_CONTROL_SET_DIE: |
|---|
| 1427 | 1430 | msg_Dbg( p_input, "control: stopping input" ); |
|---|
| | 1431 | |
|---|
| 1428 | 1432 | /* 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 ); |
|---|
| 1436 | 1434 | break; |
|---|
| 1437 | 1435 | |
|---|