Changeset 267cd7f9b7dac986e6d2bc490f778107be95a8fc

Show
Ignore:
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
  • include/vlc_objects.h

    r5601054 r267cd7f  
    3333 
    3434/* Object types */ 
    35 #define VLC_OBJECT_ROOT        (-1) 
     35#define VLC_OBJECT_GLOBAL      (-1) 
    3636#define VLC_OBJECT_LIBVLC      (-2) 
    3737#define VLC_OBJECT_MODULE      (-3) 
  • src/libvlc-common.c

    rbb5f959 r267cd7f  
    209209#endif 
    210210 
    211     /* Store our newly allocated structure in the global list */ 
    212     vlc_object_attach( p_libvlc, p_libvlc_global ); 
    213  
    214211    /* Store data for the non-reentrant API */ 
    215212    p_static_vlc = p_libvlc; 
     
    908905    vlc_mutex_destroy( &p_libvlc->config_lock ); 
    909906 
    910     vlc_object_detach( p_libvlc ); 
    911907    if( b_release ) vlc_object_release( p_libvlc ); 
    912908    vlc_object_destroy( p_libvlc ); 
  • src/misc/messages.c

    rc6e7cf1 r267cd7f  
    199199    switch( i_object_type ) 
    200200    { 
    201         case VLC_OBJECT_ROOT: return "root"; 
     201        case VLC_OBJECT_GLOBAL: return "global"; 
    202202        case VLC_OBJECT_LIBVLC: return "libvlc"; 
    203203        case VLC_OBJECT_MODULE: return "module"; 
     
    334334    { 
    335335        char *psz_old = NULL; 
    336         if( p_obj == NULL ) break; 
    337336        if( p_obj->psz_header ) 
    338337        { 
  • src/misc/objects.c

    rbd3484b r267cd7f  
    8383static vlc_mutex_t    structure_lock; 
    8484 
    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  
    9385/** 
    9486 * Initialize a vlc object 
    9587 * 
    9688 * 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 
    9890 * so on, vlc_object_create will use its value for the object size. 
    9991 */ 
     
    10698    switch( i_type ) 
    10799    { 
    108         case VLC_OBJECT_ROOT
     100        case VLC_OBJECT_GLOBAL
    109101            i_size = sizeof(libvlc_global_data_t); 
    110             psz_type = "root"; 
     102            psz_type = "global"; 
    111103            break; 
    112104        case VLC_OBJECT_LIBVLC: 
     
    230222    } 
    231223 
    232     if( i_type == VLC_OBJECT_ROOT
     224    if( i_type == VLC_OBJECT_GLOBAL
    233225    { 
    234226        p_new = p_this; 
     
    267259    if( !p_new->p_vars ) 
    268260    { 
    269         if( i_type != VLC_OBJECT_ROOT
     261        if( i_type != VLC_OBJECT_GLOBAL
    270262            free( p_new ); 
    271263        return NULL; 
    272264    } 
    273265 
    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 */ 
    277269        p_new->p_libvlc_global = (libvlc_global_data_t*)p_new; 
    278270        p_new->p_libvlc = NULL; 
     
    318310    vlc_mutex_init( p_new, &p_new->var_lock ); 
    319311 
    320     if( i_type == VLC_OBJECT_ROOT
     312    if( i_type == VLC_OBJECT_GLOBAL
    321313    { 
    322314        vlc_mutex_init( p_new, &structure_lock ); 
     
    399391    if( p_this->psz_header ) free( p_this->psz_header ); 
    400392 
    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. */ 
    404396        free( p_this->p_libvlc_global->pp_objects ); 
    405397        p_this->p_libvlc_global->pp_objects = NULL; 
     
    427419    vlc_cond_destroy( &p_this->object_wait ); 
    428420 
    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
    431423        free( p_this ); 
    432424} 
  • src/misc/threads.c

    r955b873 r267cd7f  
    118118#endif 
    119119 
    120         p_root = vlc_object_create( p_libvlc_global, VLC_OBJECT_ROOT ); 
     120        p_root = vlc_object_create( p_libvlc_global, VLC_OBJECT_GLOBAL ); 
    121121        if( p_root == NULL ) 
    122122            i_ret = VLC_ENOMEM;