From: RĂ©mi Denis-Courmont Date: Sat, 5 Jul 2008 12:04:10 +0000 (+0300) Subject: interaction: safely join the thread X-Git-Tag: 0.9.0-test2~256 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=d2ff9ebf3b5c789711a83777986b1d07261afd67;p=vlc interaction: safely join the thread --- diff --git a/src/interface/interaction.c b/src/interface/interaction.c index 59a4f0f5eb..6eab001827 100644 --- a/src/interface/interaction.c +++ b/src/interface/interaction.c @@ -388,6 +388,16 @@ interaction_t * interaction_Init( libvlc_int_t *p_libvlc ) return p_interaction; } +void interaction_Destroy( interaction_t *p_interaction ) +{ + if( !p_interaction ) + return; + + vlc_object_kill( p_interaction ); + vlc_thread_join( p_interaction ); + vlc_object_release( p_interaction ); +} + /********************************************************************** * The following functions are local **********************************************************************/ diff --git a/src/interface/interface.h b/src/interface/interface.h index 82530d9aaa..6401ccdd7f 100644 --- a/src/interface/interface.h +++ b/src/interface/interface.h @@ -34,7 +34,7 @@ * Interaction **********************************************************************/ -/* release via vlc_object_release() */ interaction_t * interaction_Init( libvlc_int_t *p_libvlc ); +void interaction_Destroy( interaction_t * ); #endif diff --git a/src/libvlc.c b/src/libvlc.c index 1e62c1fdf1..73eed93270 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -964,7 +964,7 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc ) /* Free interaction */ msg_Dbg( p_libvlc, "removing interaction" ); - vlc_object_release( priv->p_interaction ); + interaction_Destroy( priv->p_interaction ); /* Free video outputs */ msg_Dbg( p_libvlc, "removing all video outputs" );