]> git.sesse.net Git - vlc/commitdiff
Remove VLC_OBJECT_GLOBAL
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 4 May 2008 16:16:00 +0000 (19:16 +0300)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 4 May 2008 16:16:06 +0000 (19:16 +0300)
include/vlc_objects.h
modules/misc/lua/objects.c
src/misc/objects.c
src/misc/threads.c

index 828510442a30f4d2184d91e75a27a85036d4d144..da73ea8e1818489ee1ed71e68d02a1e3855bdc97 100644 (file)
@@ -36,7 +36,7 @@
  */
 
 /* Object types */
-#define VLC_OBJECT_GLOBAL      (-1)
+
 #define VLC_OBJECT_LIBVLC      (-2)
 #define VLC_OBJECT_MODULE      (-3)
 #define VLC_OBJECT_INTF        (-4)
index 9feff684d9de900a6b0807361d22c30bcf912481..deb99189f93beb3818a02c874f62ccebc5a497f5 100644 (file)
@@ -107,8 +107,7 @@ static int vlc_object_type_from_string( const char *psz_name )
         int i_type;
         const char *psz_name;
     } pp_objects[] =
-        { { VLC_OBJECT_GLOBAL, "global" },
-          { VLC_OBJECT_LIBVLC, "libvlc" },
+        { { VLC_OBJECT_LIBVLC, "libvlc" },
           { VLC_OBJECT_MODULE, "module" },
           { VLC_OBJECT_INTF, "intf" },
           { VLC_OBJECT_PLAYLIST, "playlist" },
index 33c8b32de18794d9857d309b0476be9d7911c63b..2395698e403eac5f722873ea89334f711b61b203 100644 (file)
@@ -143,9 +143,9 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     }
 
     libvlc_global_data_t *p_libvlc_global;
-    if( i_type == VLC_OBJECT_GLOBAL )
+    if( p_this == NULL )
     {
-        /* If i_type is global, then p_new is actually p_libvlc_global */
+        /* Only the global root object is created out of the blue */
         p_libvlc_global = (libvlc_global_data_t *)p_new;
         p_new->p_libvlc = NULL;
 
@@ -379,10 +379,12 @@ static void vlc_object_destroy( vlc_object_t *p_this )
 
     free( p_this->psz_header );
 
-    if( p_this->i_object_type == VLC_OBJECT_GLOBAL )
+    if( p_this->p_libvlc == NULL )
     {
         libvlc_global_data_t *p_global = (libvlc_global_data_t *)p_this;
 
+#ifndef NDEBUG
+        assert( p_global == vlc_global() );
         /* Test for leaks */
         if( p_global->i_objects > 0 )
         {
@@ -408,6 +410,7 @@ static void vlc_object_destroy( vlc_object_t *p_this )
             /* Strongly abort, cause we want these to be fixed */
             abort();
         }
+#endif
 
         /* We are the global object ... no need to lock. */
         free( p_global->pp_objects );
index 48d349830296e17b6a26cfdd9f057384b97fba1d..8b0b3b9e5629a584f6a42f9760fb2cca2b1d3504 100644 (file)
@@ -143,7 +143,7 @@ int vlc_threads_init( void )
     if( i_initializations == 0 )
     {
         p_root = vlc_custom_create( NULL, sizeof( *p_root ),
-                                    VLC_OBJECT_GLOBAL, "global" );
+                                    VLC_OBJECT_GENERIC, "root" );
         if( p_root == NULL )
         {
             i_ret = VLC_ENOMEM;