Changeset b187d11b4c62350735a452f6b523b642cb37b4ab
- Timestamp:
- 05/14/08 19:15:31
(2 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1210785331 +0300
- git-parent:
[58a1d71baee1aac656ff54356104261d780e4a6d]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1210785331 +0300
- Message:
Detach dying objects atomically, so FIND_CHILDREN is safe
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r58a1d71 |
rb187d11 |
|
| 84 | 84 | |
|---|
| 85 | 85 | static void vlc_object_destroy( vlc_object_t *p_this ); |
|---|
| | 86 | static void vlc_object_detach_unlocked (vlc_object_t *p_this); |
|---|
| 86 | 87 | |
|---|
| 87 | 88 | /***************************************************************************** |
|---|
| … | … | |
| 316 | 317 | vlc_object_internals_t *p_priv = vlc_internals( p_this ); |
|---|
| 317 | 318 | |
|---|
| 318 | | /* Automatically detach the object from its parent */ |
|---|
| 319 | | if( p_this->p_parent ) vlc_object_detach( p_this ); |
|---|
| 320 | | |
|---|
| | 319 | /* Objects are always detached beforehand */ |
|---|
| | 320 | assert( !p_this->p_parent ); |
|---|
| 321 | 321 | |
|---|
| 322 | 322 | /* Send a kill to the object's thread if applicable */ |
|---|
| … | … | |
| 885 | 885 | REMOVE_ELEM( p_libvlc_global->pp_objects, |
|---|
| 886 | 886 | p_libvlc_global->i_objects, i_index ); |
|---|
| | 887 | if (p_this->p_parent) |
|---|
| | 888 | vlc_object_detach_unlocked (p_this); |
|---|
| 887 | 889 | } |
|---|
| 888 | 890 | |
|---|
| … | … | |
| 922 | 924 | } |
|---|
| 923 | 925 | |
|---|
| | 926 | |
|---|
| | 927 | static void vlc_object_detach_unlocked (vlc_object_t *p_this) |
|---|
| | 928 | { |
|---|
| | 929 | assert (p_this->p_parent); |
|---|
| | 930 | |
|---|
| | 931 | /* Climb up the tree to see whether we are connected with the root */ |
|---|
| | 932 | if( vlc_internals( p_this->p_parent )->b_attached ) |
|---|
| | 933 | SetAttachment( p_this, false ); |
|---|
| | 934 | |
|---|
| | 935 | DetachObject( p_this ); |
|---|
| | 936 | } |
|---|
| | 937 | |
|---|
| | 938 | |
|---|
| 924 | 939 | /** |
|---|
| 925 | 940 | **************************************************************************** |
|---|
| … | … | |
| 941 | 956 | } |
|---|
| 942 | 957 | |
|---|
| 943 | | /* Climb up the tree to see whether we are connected with the root */ |
|---|
| 944 | | if( vlc_internals( p_this->p_parent )->b_attached ) |
|---|
| 945 | | { |
|---|
| 946 | | SetAttachment( p_this, false ); |
|---|
| 947 | | } |
|---|
| 948 | | |
|---|
| 949 | | DetachObject( p_this ); |
|---|
| | 958 | vlc_object_detach_unlocked( p_this ); |
|---|
| 950 | 959 | vlc_mutex_unlock( &structure_lock ); |
|---|
| 951 | | p_this = NULL; |
|---|
| 952 | 960 | } |
|---|
| 953 | 961 | |
|---|