Changeset bb84da65bde754021ec602e99e3861b7e8ebafa3
- Timestamp:
- 05/14/08 20:58:16
(4 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1210791496 +0300
- git-parent:
[52d943331f7d21d9de67d025ff06d33d0ae5eee8]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1210791496 +0300
- Message:
Debug code to prevent FIND_PARENT from crashing.
This will postpone a due abort or turn a crash into an abort.
Objects must not have children when they are destroyed per the current
design, though this seems to be a questionable choice.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r52d9433 |
rbb84da6 |
|
| 867 | 867 | if( b_should_destroy ) |
|---|
| 868 | 868 | { |
|---|
| 869 | | /* Remove the object from the table so that it cannot be returned from |
|---|
| 870 | | * vlc_object_find() and friends. */ |
|---|
| | 869 | /* Remove the object from the table |
|---|
| | 870 | * so that it cannot be encountered by vlc_object_get() */ |
|---|
| 871 | 871 | libvlc_global_data_t *p_libvlc_global = vlc_global(); |
|---|
| 872 | 872 | int i_index; |
|---|
| … | … | |
| 876 | 876 | REMOVE_ELEM( p_libvlc_global->pp_objects, |
|---|
| 877 | 877 | p_libvlc_global->i_objects, i_index ); |
|---|
| | 878 | |
|---|
| | 879 | /* Detach from parent to protect against FIND_CHILDREN */ |
|---|
| 878 | 880 | if (p_this->p_parent) |
|---|
| 879 | 881 | vlc_object_detach_unlocked (p_this); |
|---|
| | 882 | #ifndef NDEBUG |
|---|
| | 883 | /* Detach from children to protect against FIND_PARENT. |
|---|
| | 884 | * Destroying an object with children is currently not allowed anyway. |
|---|
| | 885 | * This code is there only to ensure that the debugging code in |
|---|
| | 886 | * vlc_object_destroy() will be invoked before a concurrent |
|---|
| | 887 | * FIND_PARENT gets the chance to crash the process. */ |
|---|
| | 888 | for (int i = 0; i < p_this->i_children; i++) |
|---|
| | 889 | p_this->pp_children[i]->p_parent = NULL; |
|---|
| | 890 | #endif |
|---|
| 880 | 891 | } |
|---|
| 881 | 892 | |
|---|
| … | … | |
| 900 | 911 | |
|---|
| 901 | 912 | /* Attach the parent to its child */ |
|---|
| | 913 | assert (!p_this->p_parent); |
|---|
| 902 | 914 | p_this->p_parent = p_parent; |
|---|
| 903 | 915 | |
|---|