[vlc-devel] commit: An object must not have a thread when it is destroyed ( Rémi Denis-Courmont )
git version control
git at videolan.org
Mon Aug 25 18:38:43 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Aug 24 16:18:26 2008 +0300| [a7d75d8f48a0cc7eff28fdc7bd95798aa18ad4a7] | committer: Rémi Denis-Courmont
An object must not have a thread when it is destroyed
Assert rather than invoke a crashy work-around.
Also allow the type-specific cleanup function to join the thread.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a7d75d8f48a0cc7eff28fdc7bd95798aa18ad4a7
---
src/misc/objects.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/misc/objects.c b/src/misc/objects.c
index b7ed1e6..a05677f 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -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 )
More information about the vlc-devel
mailing list