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)
-#define VLC_OBJECT_ROOT (-1)
+#define VLC_OBJECT_GLOBAL (-1)
#define VLC_OBJECT_LIBVLC (-2)
#define VLC_OBJECT_MODULE (-3)
#define VLC_OBJECT_INTF (-4)
#define VLC_OBJECT_LIBVLC (-2)
#define VLC_OBJECT_MODULE (-3)
#define VLC_OBJECT_INTF (-4)
vlc_thread_set_priority( p_libvlc, VLC_THREAD_PRIORITY_LOW );
#endif
vlc_thread_set_priority( p_libvlc, VLC_THREAD_PRIORITY_LOW );
#endif
- /* Store our newly allocated structure in the global list */
- vlc_object_attach( p_libvlc, p_libvlc_global );
-
/* Store data for the non-reentrant API */
p_static_vlc = p_libvlc;
/* Store data for the non-reentrant API */
p_static_vlc = p_libvlc;
/* Destroy mutexes */
vlc_mutex_destroy( &p_libvlc->config_lock );
/* Destroy mutexes */
vlc_mutex_destroy( &p_libvlc->config_lock );
- vlc_object_detach( p_libvlc );
if( b_release ) vlc_object_release( p_libvlc );
vlc_object_destroy( p_libvlc );
if( b_release ) vlc_object_release( p_libvlc );
vlc_object_destroy( p_libvlc );
{
switch( i_object_type )
{
{
switch( i_object_type )
{
- case VLC_OBJECT_ROOT: return "root";
+ case VLC_OBJECT_GLOBAL: return "global";
case VLC_OBJECT_LIBVLC: return "libvlc";
case VLC_OBJECT_MODULE: return "module";
case VLC_OBJECT_INTF: return "interface";
case VLC_OBJECT_LIBVLC: return "libvlc";
case VLC_OBJECT_MODULE: return "module";
case VLC_OBJECT_INTF: return "interface";
while( p_obj != NULL )
{
char *psz_old = NULL;
while( p_obj != NULL )
{
char *psz_old = NULL;
- if( p_obj == NULL ) break;
if( p_obj->psz_header )
{
i_header_size += strlen( p_obj->psz_header ) + 4;
if( p_obj->psz_header )
{
i_header_size += strlen( p_obj->psz_header ) + 4;
*****************************************************************************/
static vlc_mutex_t structure_lock;
*****************************************************************************/
static vlc_mutex_t structure_lock;
-/*****************************************************************************
- * vlc_object_create: initialize a vlc object
- *****************************************************************************
- * This function allocates memory for a vlc object and initializes it. If
- * i_type is not a known value such as VLC_OBJECT_ROOT, VLC_OBJECT_VOUT and
- * so on, vlc_object_create will use its value for the object size.
- *****************************************************************************/
-
/**
* Initialize a vlc object
*
* This function allocates memory for a vlc object and initializes it. If
/**
* Initialize a vlc object
*
* This function allocates memory for a vlc object and initializes it. If
- * i_type is not a known value such as VLC_OBJECT_ROOT, VLC_OBJECT_VOUT and
+ * i_type is not a known value such as VLC_OBJECT_LIBVLC, VLC_OBJECT_VOUT and
* so on, vlc_object_create will use its value for the object size.
*/
void * __vlc_object_create( vlc_object_t *p_this, int i_type )
* so on, vlc_object_create will use its value for the object size.
*/
void * __vlc_object_create( vlc_object_t *p_this, int i_type )
+ case VLC_OBJECT_GLOBAL:
i_size = sizeof(libvlc_global_data_t);
i_size = sizeof(libvlc_global_data_t);
break;
case VLC_OBJECT_LIBVLC:
i_size = sizeof(libvlc_int_t);
break;
case VLC_OBJECT_LIBVLC:
i_size = sizeof(libvlc_int_t);
- if( i_type == VLC_OBJECT_ROOT )
+ if( i_type == VLC_OBJECT_GLOBAL )
- if( i_type != VLC_OBJECT_ROOT )
+ if( i_type != VLC_OBJECT_GLOBAL )
free( p_new );
return NULL;
}
free( p_new );
return NULL;
}
- if( i_type == VLC_OBJECT_ROOT )
+ if( i_type == VLC_OBJECT_GLOBAL )
- /* If i_type is root, then p_new is actually p_libvlc_global */
+ /* If i_type is global, then p_new is actually p_libvlc_global */
p_new->p_libvlc_global = (libvlc_global_data_t*)p_new;
p_new->p_libvlc = NULL;
p_new->p_libvlc_global = (libvlc_global_data_t*)p_new;
p_new->p_libvlc = NULL;
vlc_cond_init( p_new, &p_new->object_wait );
vlc_mutex_init( p_new, &p_new->var_lock );
vlc_cond_init( p_new, &p_new->object_wait );
vlc_mutex_init( p_new, &p_new->var_lock );
- if( i_type == VLC_OBJECT_ROOT )
+ if( i_type == VLC_OBJECT_GLOBAL )
{
vlc_mutex_init( p_new, &structure_lock );
{
vlc_mutex_init( p_new, &structure_lock );
if( p_this->psz_header ) free( p_this->psz_header );
if( p_this->psz_header ) free( p_this->psz_header );
- if( p_this->i_object_type == VLC_OBJECT_ROOT )
+ if( p_this->i_object_type == VLC_OBJECT_GLOBAL )
- /* We are the root object ... no need to lock. */
+ /* We are the global object ... no need to lock. */
free( p_this->p_libvlc_global->pp_objects );
p_this->p_libvlc_global->pp_objects = NULL;
p_this->p_libvlc_global->i_objects--;
free( p_this->p_libvlc_global->pp_objects );
p_this->p_libvlc_global->pp_objects = NULL;
p_this->p_libvlc_global->i_objects--;
vlc_mutex_destroy( &p_this->object_lock );
vlc_cond_destroy( &p_this->object_wait );
vlc_mutex_destroy( &p_this->object_lock );
vlc_cond_destroy( &p_this->object_wait );
- /* root is not dynamically allocated by vlc_object_create */
- if( p_this->i_object_type != VLC_OBJECT_ROOT )
+ /* global is not dynamically allocated by vlc_object_create */
+ if( p_this->i_object_type != VLC_OBJECT_GLOBAL )
#elif defined( HAVE_CTHREADS_H )
#endif
#elif defined( HAVE_CTHREADS_H )
#endif
- p_root = vlc_object_create( p_libvlc_global, VLC_OBJECT_ROOT );
+ p_root = vlc_object_create( p_libvlc_global, VLC_OBJECT_GLOBAL );
if( p_root == NULL )
i_ret = VLC_ENOMEM;
if( p_root == NULL )
i_ret = VLC_ENOMEM;