]> git.sesse.net Git - vlc/blobdiff - src/misc/objects.c
remove unused patch
[vlc] / src / misc / objects.c
index 96214c14d0710889a451e8df0252bc433da03894..a05677f4ae49950f6fe27b519f62c9f56a4a4be2 100644 (file)
@@ -94,7 +94,8 @@ static void held_objects_destroy (void *);
 /*****************************************************************************
  * Local structure lock
  *****************************************************************************/
-static vlc_mutex_t     structure_lock;
+static vlc_mutex_t structure_lock;
+static unsigned    object_counter = 0;
 
 void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size,
                            int i_type, const char *psz_type )
@@ -148,7 +149,7 @@ void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size,
         p_libvlc_global = (libvlc_global_data_t *)p_new;
         p_new->p_libvlc = NULL;
 
-        p_libvlc_global->i_counter = 0;
+        object_counter = 0; /* reset */
         p_priv->next = p_priv->prev = p_new;
         vlc_mutex_init( &structure_lock );
 #ifdef LIBVLC_REFCHECK
@@ -194,7 +195,7 @@ void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     p_priv->prev = vlc_internals (p_libvlc_global)->prev;
     vlc_internals (p_libvlc_global)->prev = p_new;
     vlc_internals (p_priv->prev)->next = p_new;
-    p_new->i_object_id = p_libvlc_global->i_counter++;
+    p_new->i_object_id = object_counter++; /* fetch THEN increment */
     vlc_mutex_unlock( &structure_lock );
 
     if( i_type == VLC_OBJECT_LIBVLC )
@@ -299,19 +300,13 @@ static void vlc_object_destroy( vlc_object_t *p_this )
     /* Send a kill to the object's thread if applicable */
     vlc_object_kill( p_this );
 
-    /* If we are running on a thread, wait until it ends */
-    if( p_priv->b_thread )
-    {
-        msg_Warn (p_this->p_libvlc, /* do NOT use a dead object for logging! */
-                  "%s %d destroyed while thread alive (VLC might crash)",
-                  p_this->psz_object_type, p_this->i_object_id);
-        vlc_thread_join( p_this );
-    }
-
     /* Call the custom "subclass" destructor */
     if( p_priv->pf_destructor )
         p_priv->pf_destructor( p_this );
 
+    /* Any thread must have been cleaned up at this point. */
+    assert( !p_priv->b_thread );
+
     /* Destroy the associated variables, starting from the end so that
      * no memmove calls have to be done. */
     while( p_priv->i_vars )