]> git.sesse.net Git - vlc/commitdiff
An object must not have a thread when it is destroyed
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 24 Aug 2008 13:18:26 +0000 (16:18 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Mon, 25 Aug 2008 16:41:45 +0000 (19:41 +0300)
Assert rather than invoke a crashy work-around.
Also allow the type-specific cleanup function to join the thread.

src/misc/objects.c

index b7ed1e63bf3967616d4192fa6c78e291f3575d91..a05677f4ae49950f6fe27b519f62c9f56a4a4be2 100644 (file)
@@ -300,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 )