Changeset 267cd7f9b7dac986e6d2bc490f778107be95a8fc
- Timestamp:
- 09/11/06 18:55:58
(2 years ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1163094958 +0000
- git-parent:
[c6e7cf1b17ed414e1a803cdc4341d09884485e5e]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1163094958 +0000
- Message:
- Do not attach libvlc to the global data
to avoid crashes in the messaging system (global data has no libvlc pointer)
- Rename ROOT to GLOBAL to avoid confusion (the root is LIBVLC, not GLOBAL)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r5601054 |
r267cd7f |
|
| 33 | 33 | |
|---|
| 34 | 34 | /* Object types */ |
|---|
| 35 | | #define VLC_OBJECT_ROOT (-1) |
|---|
| | 35 | #define VLC_OBJECT_GLOBAL (-1) |
|---|
| 36 | 36 | #define VLC_OBJECT_LIBVLC (-2) |
|---|
| 37 | 37 | #define VLC_OBJECT_MODULE (-3) |
|---|
| rbb5f959 |
r267cd7f |
|
| 209 | 209 | #endif |
|---|
| 210 | 210 | |
|---|
| 211 | | /* Store our newly allocated structure in the global list */ |
|---|
| 212 | | vlc_object_attach( p_libvlc, p_libvlc_global ); |
|---|
| 213 | | |
|---|
| 214 | 211 | /* Store data for the non-reentrant API */ |
|---|
| 215 | 212 | p_static_vlc = p_libvlc; |
|---|
| … | … | |
| 908 | 905 | vlc_mutex_destroy( &p_libvlc->config_lock ); |
|---|
| 909 | 906 | |
|---|
| 910 | | vlc_object_detach( p_libvlc ); |
|---|
| 911 | 907 | if( b_release ) vlc_object_release( p_libvlc ); |
|---|
| 912 | 908 | vlc_object_destroy( p_libvlc ); |
|---|
| rc6e7cf1 |
r267cd7f |
|
| 199 | 199 | switch( i_object_type ) |
|---|
| 200 | 200 | { |
|---|
| 201 | | case VLC_OBJECT_ROOT: return "root"; |
|---|
| | 201 | case VLC_OBJECT_GLOBAL: return "global"; |
|---|
| 202 | 202 | case VLC_OBJECT_LIBVLC: return "libvlc"; |
|---|
| 203 | 203 | case VLC_OBJECT_MODULE: return "module"; |
|---|
| … | … | |
| 334 | 334 | { |
|---|
| 335 | 335 | char *psz_old = NULL; |
|---|
| 336 | | if( p_obj == NULL ) break; |
|---|
| 337 | 336 | if( p_obj->psz_header ) |
|---|
| 338 | 337 | { |
|---|
| rbd3484b |
r267cd7f |
|
| 83 | 83 | static vlc_mutex_t structure_lock; |
|---|
| 84 | 84 | |
|---|
| 85 | | /***************************************************************************** |
|---|
| 86 | | * vlc_object_create: initialize a vlc object |
|---|
| 87 | | ***************************************************************************** |
|---|
| 88 | | * This function allocates memory for a vlc object and initializes it. If |
|---|
| 89 | | * i_type is not a known value such as VLC_OBJECT_ROOT, VLC_OBJECT_VOUT and |
|---|
| 90 | | * so on, vlc_object_create will use its value for the object size. |
|---|
| 91 | | *****************************************************************************/ |
|---|
| 92 | | |
|---|
| 93 | 85 | /** |
|---|
| 94 | 86 | * Initialize a vlc object |
|---|
| 95 | 87 | * |
|---|
| 96 | 88 | * This function allocates memory for a vlc object and initializes it. If |
|---|
| 97 | | * i_type is not a known value such as VLC_OBJECT_ROOT, VLC_OBJECT_VOUT and |
|---|
| | 89 | * i_type is not a known value such as VLC_OBJECT_LIBVLC, VLC_OBJECT_VOUT and |
|---|
| 98 | 90 | * so on, vlc_object_create will use its value for the object size. |
|---|
| 99 | 91 | */ |
|---|
| … | … | |
| 106 | 98 | switch( i_type ) |
|---|
| 107 | 99 | { |
|---|
| 108 | | case VLC_OBJECT_ROOT: |
|---|
| | 100 | case VLC_OBJECT_GLOBAL: |
|---|
| 109 | 101 | i_size = sizeof(libvlc_global_data_t); |
|---|
| 110 | | psz_type = "root"; |
|---|
| | 102 | psz_type = "global"; |
|---|
| 111 | 103 | break; |
|---|
| 112 | 104 | case VLC_OBJECT_LIBVLC: |
|---|
| … | … | |
| 230 | 222 | } |
|---|
| 231 | 223 | |
|---|
| 232 | | if( i_type == VLC_OBJECT_ROOT ) |
|---|
| | 224 | if( i_type == VLC_OBJECT_GLOBAL ) |
|---|
| 233 | 225 | { |
|---|
| 234 | 226 | p_new = p_this; |
|---|
| … | … | |
| 267 | 259 | if( !p_new->p_vars ) |
|---|
| 268 | 260 | { |
|---|
| 269 | | if( i_type != VLC_OBJECT_ROOT ) |
|---|
| | 261 | if( i_type != VLC_OBJECT_GLOBAL ) |
|---|
| 270 | 262 | free( p_new ); |
|---|
| 271 | 263 | return NULL; |
|---|
| 272 | 264 | } |
|---|
| 273 | 265 | |
|---|
| 274 | | if( i_type == VLC_OBJECT_ROOT ) |
|---|
| 275 | | { |
|---|
| 276 | | /* If i_type is root, then p_new is actually p_libvlc_global */ |
|---|
| | 266 | if( i_type == VLC_OBJECT_GLOBAL ) |
|---|
| | 267 | { |
|---|
| | 268 | /* If i_type is global, then p_new is actually p_libvlc_global */ |
|---|
| 277 | 269 | p_new->p_libvlc_global = (libvlc_global_data_t*)p_new; |
|---|
| 278 | 270 | p_new->p_libvlc = NULL; |
|---|
| … | … | |
| 318 | 310 | vlc_mutex_init( p_new, &p_new->var_lock ); |
|---|
| 319 | 311 | |
|---|
| 320 | | if( i_type == VLC_OBJECT_ROOT ) |
|---|
| | 312 | if( i_type == VLC_OBJECT_GLOBAL ) |
|---|
| 321 | 313 | { |
|---|
| 322 | 314 | vlc_mutex_init( p_new, &structure_lock ); |
|---|
| … | … | |
| 399 | 391 | if( p_this->psz_header ) free( p_this->psz_header ); |
|---|
| 400 | 392 | |
|---|
| 401 | | if( p_this->i_object_type == VLC_OBJECT_ROOT ) |
|---|
| 402 | | { |
|---|
| 403 | | /* We are the root object ... no need to lock. */ |
|---|
| | 393 | if( p_this->i_object_type == VLC_OBJECT_GLOBAL ) |
|---|
| | 394 | { |
|---|
| | 395 | /* We are the global object ... no need to lock. */ |
|---|
| 404 | 396 | free( p_this->p_libvlc_global->pp_objects ); |
|---|
| 405 | 397 | p_this->p_libvlc_global->pp_objects = NULL; |
|---|
| … | … | |
| 427 | 419 | vlc_cond_destroy( &p_this->object_wait ); |
|---|
| 428 | 420 | |
|---|
| 429 | | /* root is not dynamically allocated by vlc_object_create */ |
|---|
| 430 | | if( p_this->i_object_type != VLC_OBJECT_ROOT ) |
|---|
| | 421 | /* global is not dynamically allocated by vlc_object_create */ |
|---|
| | 422 | if( p_this->i_object_type != VLC_OBJECT_GLOBAL ) |
|---|
| 431 | 423 | free( p_this ); |
|---|
| 432 | 424 | } |
|---|
| r955b873 |
r267cd7f |
|
| 118 | 118 | #endif |
|---|
| 119 | 119 | |
|---|
| 120 | | p_root = vlc_object_create( p_libvlc_global, VLC_OBJECT_ROOT ); |
|---|
| | 120 | p_root = vlc_object_create( p_libvlc_global, VLC_OBJECT_GLOBAL ); |
|---|
| 121 | 121 | if( p_root == NULL ) |
|---|
| 122 | 122 | i_ret = VLC_ENOMEM; |
|---|