Commit a78e273e authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

misc/objects.c: Don't rely on vlc_object_destroy() to destroy objects, but...

misc/objects.c: Don't rely on vlc_object_destroy() to destroy objects, but expects vlc_object_release to do it when the refcount goes to zero.
* Meaning, that when created objects gets a refcount to 1.
* Destroying is instantaneous and we don't have to poll for a few secondss or so to wait until the object's refcount reach 0.
* We now track vlc_object_t's mem leaks when libvlc_global is released (Hard error for now, so they don't get unoticed)
* We fail hard if an object is released with a refcount of 1 without being detached from its parent and its children, to make sure such cases don't go unoticed.
(make test or make check still pass after that one. VLC is known to leak one object when no module is loaded, this must be fixed).
parent e769bca0
......@@ -232,7 +232,7 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name
module_Need( location, "packetizer", NULL, 0 ); \
if( location->p_module == NULL ) \
{ \
vlc_object_destroy( location ); \
vlc_object_release( location ); \
msg_Err( p_demux, "cannot find packetizer for " # msg ); \
free( p_sys ); \
return VLC_EGENERIC; \
......@@ -240,7 +240,7 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name
#define DESTROY_PACKETIZER( location ) \
if( location->p_module ) module_Unneed( location, location->p_module ); \
vlc_object_destroy( location );
vlc_object_release( location );
/**
* @}
......
......@@ -95,7 +95,6 @@ struct vlc_object_t
* Prototypes
*****************************************************************************/
VLC_EXPORT( void *, __vlc_object_create, ( vlc_object_t *, int ) );
VLC_EXPORT( void, __vlc_object_destroy, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t * ) );
VLC_EXPORT( void *, vlc_object_get, ( int ) );
......@@ -111,10 +110,6 @@ VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
#define vlc_object_create(a,b) \
__vlc_object_create( VLC_OBJECT(a), b )
#define vlc_object_destroy(a) do { \
__vlc_object_destroy( VLC_OBJECT(a) ); \
(a) = NULL; } while(0)
#define vlc_object_detach(a) \
__vlc_object_detach( VLC_OBJECT(a) )
......
......@@ -271,7 +271,7 @@ static void Close( vlc_object_t *p_this )
p_sys->p_ev->pp_last = &p_sys->p_frame;
vlc_mutex_unlock( &p_sys->p_ev->lock );
}
vlc_object_destroy( p_sys->p_ev );
vlc_object_release( p_sys->p_ev );
}
if( p_sys->p_frame )
......
......@@ -357,7 +357,7 @@ static void Close( vlc_object_t *p_this )
/* stop the event handler */
vlc_object_kill( p_sys->p_ev );
vlc_thread_join( p_sys->p_ev );
vlc_object_destroy( p_sys->p_ev );
vlc_object_release( p_sys->p_ev );
var_Destroy( p_sys->p_input, "highlight-mutex" );
var_Destroy( p_sys->p_input, "highlight" );
......
......@@ -269,7 +269,7 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
error:
if( p_sys->poll_thread != NULL )
vlc_object_destroy( p_sys->poll_thread );
vlc_object_release( p_sys->poll_thread );
if( p_sys->client != NULL )
avahi_client_free( p_sys->client );
if( p_sys->simple_poll != NULL )
......@@ -295,7 +295,7 @@ void bonjour_stop_service( void *_p_sys )
vlc_object_kill( p_sys->poll_thread );
vlc_thread_join( p_sys->poll_thread );
vlc_object_destroy( p_sys->poll_thread );
vlc_object_release( p_sys->poll_thread );
if( p_sys->group != NULL )
avahi_entry_group_free( p_sys->group );
......
......@@ -232,7 +232,7 @@ static int Open( vlc_object_t *p_this )
if( i_handle == -1 )
{
msg_Err( p_access, "failed to create raw UDP socket" );
vlc_object_destroy (p_sys->p_thread);
vlc_object_release (p_sys->p_thread);
free (p_sys);
return VLC_EGENERIC;
}
......@@ -271,7 +271,7 @@ static int Open( vlc_object_t *p_this )
{
msg_Err( p_access->p_sout, "cannot spawn sout access thread" );
net_Close (i_handle);
vlc_object_destroy( p_sys->p_thread );
vlc_object_release( p_sys->p_thread );
free (p_sys);
return VLC_EGENERIC;
}
......@@ -316,7 +316,7 @@ static void Close( vlc_object_t * p_this )
net_Close( p_sys->p_thread->i_handle );
vlc_object_detach( p_sys->p_thread );
vlc_object_destroy( p_sys->p_thread );
vlc_object_release( p_sys->p_thread );
/* update p_sout->i_out_pace_nocontrol */
p_access->p_sout->i_out_pace_nocontrol--;
......
......@@ -374,7 +374,7 @@ static int OpenAudio( vlc_object_t *p_this )
{
msg_Err( p_aout, "cannot create DirectSoundThread" );
CloseHandle( p_aout->output.p_sys->p_notif->event );
vlc_object_destroy( p_aout->output.p_sys->p_notif );
vlc_object_release( p_aout->output.p_sys->p_notif );
p_aout->output.p_sys->p_notif = NULL;
goto error;
}
......@@ -594,7 +594,7 @@ static void CloseAudio( vlc_object_t *p_this )
if( !p_sys->b_playing ) SetEvent( p_sys->p_notif->event );
vlc_thread_join( p_sys->p_notif );
vlc_object_destroy( p_sys->p_notif );
vlc_object_release( p_sys->p_notif );
}
/* release the secondary buffer */
......
......@@ -495,7 +495,7 @@ static void Close( vlc_object_t *p_this )
/* wake up the audio thread */
SetEvent( p_sys->event );
vlc_thread_join( p_sys->p_notif );
vlc_object_destroy( p_sys->p_notif );
vlc_object_release( p_sys->p_notif );
CloseHandle( p_sys->event );
/* Close the device */
......
......@@ -300,7 +300,7 @@ int E_(OpenChroma)( vlc_object_t *p_this )
if( !p_sys->p_swscaler->p_module || !p_sys->p_swscaler->p_owner )
{
vlc_object_detach( p_sys->p_swscaler );
vlc_object_destroy( p_sys->p_swscaler );
vlc_object_release( p_sys->p_swscaler );
free( p_vout->chroma.p_sys );
return VLC_EGENERIC;
}
......@@ -355,7 +355,7 @@ void E_(CloseChroma)( vlc_object_t *p_this )
free( p_sys->p_swscaler->p_owner );
module_Unneed( p_sys->p_swscaler, p_sys->p_swscaler->p_module );
vlc_object_detach( p_sys->p_swscaler );
vlc_object_destroy( p_sys->p_swscaler );
vlc_object_release( p_sys->p_swscaler );
p_sys->p_swscaler= NULL;
}
free( p_vout->chroma.p_sys );
......
......@@ -1036,7 +1036,7 @@ void E_(CloseEncoder)( vlc_object_t *p_this )
vlc_thread_join( pp_contexts[i] );
vlc_mutex_destroy( &pp_contexts[i]->lock );
vlc_cond_destroy( &pp_contexts[i]->cond );
vlc_object_destroy( pp_contexts[i] );
vlc_object_release( pp_contexts[i] );
}
free( pp_contexts );
......
......@@ -152,7 +152,7 @@ static int Open( vlc_object_t * p_this )
{
if( p_sys->p_packetizer->fmt_in.p_extra )
free( p_sys->p_packetizer->fmt_in.p_extra );
vlc_object_destroy( p_sys->p_packetizer );
vlc_object_release( p_sys->p_packetizer );
msg_Err( p_demux, "cannot find flac packetizer" );
return VLC_EGENERIC;
......@@ -193,7 +193,7 @@ static void Close( vlc_object_t * p_this )
free( p_sys->p_packetizer->fmt_in.p_extra );
/* Delete the decoder */
vlc_object_destroy( p_sys->p_packetizer );
vlc_object_release( p_sys->p_packetizer );
if( p_sys->p_meta )
vlc_meta_Delete( p_sys->p_meta );
free( p_sys );
......
......@@ -398,7 +398,7 @@ error:
vlc_object_kill( p_sys->p_timeout );
vlc_thread_join( p_sys->p_timeout );
vlc_object_detach( p_sys->p_timeout );
vlc_object_destroy( p_sys->p_timeout );
vlc_object_release( p_sys->p_timeout );
}
if( p_sys->scheduler ) delete p_sys->scheduler;
if( p_sys->p_sdp ) free( p_sys->p_sdp );
......@@ -439,7 +439,7 @@ static void Close( vlc_object_t *p_this )
vlc_object_kill( p_sys->p_timeout );
vlc_thread_join( p_sys->p_timeout );
vlc_object_detach( p_sys->p_timeout );
vlc_object_destroy( p_sys->p_timeout );
vlc_object_release( p_sys->p_timeout );
}
if( p_sys->scheduler ) delete p_sys->scheduler;
if( p_sys->p_sdp ) free( p_sys->p_sdp );
......@@ -1033,7 +1033,7 @@ static int Play( demux_t *p_demux )
VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
{
msg_Err( p_demux, "cannot spawn liveMedia timeout thread" );
vlc_object_destroy( p_sys->p_timeout );
vlc_object_release( p_sys->p_timeout );
}
msg_Dbg( p_demux, "spawned timeout thread" );
vlc_object_attach( p_sys->p_timeout, p_demux );
......
......@@ -2693,7 +2693,7 @@ void demux_sys_t::StopUiThread()
{
vlc_object_kill( p_ev );
vlc_thread_join( p_ev );
vlc_object_destroy( p_ev );
vlc_object_release( p_ev );
p_ev = NULL;
......
......@@ -546,7 +546,7 @@ static void CloseBlending( intf_thread_t *p_intf )
p_intf->p_sys->p_blend->p_module );
vlc_object_detach( p_intf->p_sys->p_blend );
vlc_object_destroy( p_intf->p_sys->p_blend );
vlc_object_release( p_intf->p_sys->p_blend );
}
}
#endif
......@@ -597,7 +597,7 @@ static void CloseTextRenderer( intf_thread_t *p_intf )
p_intf->p_sys->p_text->p_module );
vlc_object_detach( p_intf->p_sys->p_text );
vlc_object_destroy( p_intf->p_sys->p_text );
vlc_object_release( p_intf->p_sys->p_text );
}
}
#if 0
......@@ -636,7 +636,7 @@ static int CloseScaling( intf_thread_t *p_intf )
p_intf->p_sys->p_scale->p_module );
vlc_object_detach( p_intf->p_sys->p_scale );
vlc_object_destroy( p_intf->p_sys->p_scale );
vlc_object_release( p_intf->p_sys->p_scale );
}
}
#endif
......
......@@ -116,7 +116,7 @@ Dialogs::~Dialogs()
vlc_object_detach( m_pProvider );
module_Unneed( m_pProvider, m_pModule );
vlc_object_destroy( m_pProvider );
vlc_object_release( m_pProvider );
}
/* Unregister callbacks */
......@@ -170,7 +170,7 @@ bool Dialogs::init()
if( m_pModule == NULL )
{
msg_Err( getIntf(), "no suitable dialogs provider found (hint: compile the wxWidgets plugin, and make sure it is loaded properly)" );
vlc_object_destroy( m_pProvider );
vlc_object_release( m_pProvider );
m_pProvider = NULL;
return false;
}
......
......@@ -249,7 +249,7 @@ static void Unload( intf_thread_t *p_this )
if( p_this->p_module )
module_Unneed( p_this, p_this->p_module );
vlc_mutex_destroy( &p_this->change_lock );
vlc_object_destroy( p_this );
vlc_object_release( p_this );
}
/*****************************************************************************
......
......@@ -408,7 +408,7 @@ static int Create( vlc_object_t *p_this )
}
else
{
vlc_object_destroy( p_fontbuilder );
vlc_object_release( p_fontbuilder );
}
}
else
......
......@@ -936,7 +936,7 @@ gnutls_SessionClose (tls_server_t *p_server, tls_session_t *p_session)
gnutls_deinit( p_sys->session );
vlc_object_detach( p_session );
vlc_object_destroy( p_session );
vlc_object_release( p_session );
free( p_sys );
}
......@@ -960,7 +960,7 @@ gnutls_ServerSessionPrepare( tls_server_t *p_server )
p_session->p_sys = malloc( sizeof(struct tls_session_sys_t) );
if( p_session->p_sys == NULL )
{
vlc_object_destroy( p_session );
vlc_object_release( p_session );
return NULL;
}
......@@ -1016,7 +1016,7 @@ gnutls_ServerSessionPrepare( tls_server_t *p_server )
error:
free( p_session->p_sys );
vlc_object_detach( p_session );
vlc_object_destroy( p_session );
vlc_object_release( p_session );
return NULL;
}
......
......@@ -111,7 +111,7 @@ static int Open( vlc_object_t *p_this )
if( vlc_thread_create( p_gtk_main, "gtk_main", GtkMain,
VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
{
vlc_object_destroy( p_gtk_main );
vlc_object_release( p_gtk_main );
i_refcount--;
vlc_mutex_unlock( lock );
return VLC_ETHREAD;
......@@ -143,7 +143,7 @@ static void Close( vlc_object_t *p_this )
gtk_main_quit();
vlc_thread_join( p_gtk_main );
vlc_object_destroy( p_gtk_main );
vlc_object_release( p_gtk_main );
p_gtk_main = NULL;
vlc_mutex_unlock( lock );
......
......@@ -105,7 +105,7 @@ static int Open( vlc_object_t *p_this )
if( vlc_thread_create( p_qte_main, "qte_main", QteMain,
VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
{
vlc_object_destroy( p_qte_main );
vlc_object_release( p_qte_main );
i_refcount--;
vlc_mutex_unlock( lock );
return VLC_ETHREAD;
......@@ -145,7 +145,7 @@ static void Close( vlc_object_t *p_this )
msg_Dbg( p_this, "Detaching qte_main" );
vlc_object_detach( p_qte_main );
vlc_object_destroy( p_qte_main );
vlc_object_release( p_qte_main );
p_qte_main = NULL;
vlc_mutex_unlock( lock );
......
......@@ -181,7 +181,7 @@ static int Callback( vlc_object_t *p_this, char const *psz_cmd,
vlc_object_kill( pp_objects[i] );
vlc_thread_join( pp_objects[i] );
vlc_object_detach( pp_objects[i] );
vlc_object_destroy( pp_objects[i] );
vlc_object_release( pp_objects[i] );
}
/* Clean our mess */
......@@ -313,7 +313,7 @@ static int Stress( vlc_object_t *p_this, char const *psz_cmd,
printf( " - destroying the objects (LIFO)\n" );
for( i = MAXOBJ * i_level; i--; )
{
vlc_object_destroy( pp_objects[i] );
vlc_object_release( pp_objects[i] );
}
printf( "done (%fs).\n", (mdate() - start) / 1000000.0 );
......@@ -393,7 +393,7 @@ static int Stress( vlc_object_t *p_this, char const *psz_cmd,
{
pp_objects[i]->b_die = VLC_TRUE;
vlc_thread_join( pp_objects[i] );
vlc_object_destroy( pp_objects[i] );
vlc_object_release( pp_objects[i] );
}
printf( "done (%fs).\n", (mdate() - start) / 1000000.0 );
......@@ -428,7 +428,7 @@ static void * Dummy( vlc_object_t *p_this )
for( i = MAXOBJ/MAXTH; i--; )
{
vlc_object_destroy( pp_objects[i] );
vlc_object_release( pp_objects[i] );
}
return NULL;
......
......@@ -308,7 +308,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
{
msg_Err( p_stream, "cannot find decoder" );
vlc_object_detach( p_sys->p_decoder );
vlc_object_destroy( p_sys->p_decoder );
vlc_object_release( p_sys->p_decoder );
return NULL;
}
......@@ -417,7 +417,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
"no video filter matching name \"%s\" found",
psz_name );
vlc_object_detach( *pp_vfilter );
vlc_object_destroy( *pp_vfilter );
vlc_object_release( *pp_vfilter );
p_sys->i_vfilters--;
}
}
......@@ -448,7 +448,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
if( p_sys->p_decoder->p_module )
module_Unneed( p_sys->p_decoder, p_sys->p_decoder->p_module );
vlc_object_detach( p_sys->p_decoder );
vlc_object_destroy( p_sys->p_decoder );
vlc_object_release( p_sys->p_decoder );
for( i = 0; i < PICTURE_RING_SIZE; i++ )
{
......@@ -470,7 +470,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
vlc_object_detach( *pp_vfilter );
if( (*pp_vfilter)->p_module )
module_Unneed( *pp_vfilter, (*pp_vfilter)->p_module );
vlc_object_destroy( *pp_vfilter );
vlc_object_release( *pp_vfilter );
}
free( p_sys->pp_vfilters );
......
......@@ -1210,7 +1210,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
if( p_sys->b_export_sdp_file ) FileSetup( p_stream );
vlc_object_detach( id );
vlc_object_destroy( id );
vlc_object_release( id );
return VLC_SUCCESS;
}
......
......@@ -472,7 +472,7 @@ static int Open( vlc_object_t *p_this )
if( !p_sys->p_out )
{
msg_Err( p_stream, "cannot create chain" );
vlc_object_destroy( p_sys );
vlc_object_release( p_sys );
return VLC_EGENERIC;
}
......@@ -884,7 +884,7 @@ static void Close( vlc_object_t * p_this )
}
if( p_sys->psz_osdenc ) free( p_sys->psz_osdenc );
vlc_object_destroy( p_sys );
vlc_object_release( p_sys );
}
struct sout_stream_id_t
......@@ -1113,7 +1113,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
if( id->p_decoder )
{
vlc_object_detach( id->p_decoder );
vlc_object_destroy( id->p_decoder );
vlc_object_release( id->p_decoder );
id->p_decoder = NULL;
}
......@@ -1121,7 +1121,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
{
vlc_object_detach( id->p_encoder );
es_format_Clean( &id->p_encoder->fmt_out );
vlc_object_destroy( id->p_encoder );
vlc_object_release( id->p_encoder );
id->p_encoder = NULL;
}
......@@ -1157,7 +1157,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
if( id->p_decoder )
{
vlc_object_detach( id->p_decoder );
vlc_object_destroy( id->p_decoder );
vlc_object_release( id->p_decoder );
id->p_decoder = NULL;
}
......@@ -1165,7 +1165,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
{
vlc_object_detach( id->p_encoder );
es_format_Clean( &id->p_encoder->fmt_out );
vlc_object_destroy( id->p_encoder );
vlc_object_release( id->p_encoder );
id->p_encoder = NULL;
}
free( id );
......@@ -1301,7 +1301,7 @@ static filter_t *transcode_audio_filter_new( sout_stream_t *p_stream,
else
{
vlc_object_detach( p_filter );
vlc_object_destroy( p_filter );
vlc_object_release( p_filter );
p_filter = 0;
}
......@@ -1525,14 +1525,14 @@ static void transcode_audio_close( sout_stream_id_t *id )
vlc_object_detach( id->pp_filter[i] );
if( id->pp_filter[i]->p_module )
module_Unneed( id->pp_filter[i], id->pp_filter[i]->p_module );
vlc_object_destroy( id->pp_filter[i] );
vlc_object_release( id->pp_filter[i] );
}
for( i = 0; i < id->i_ufilter; i++ )
{
vlc_object_detach( id->pp_ufilter[i] );
if( id->pp_ufilter[i]->p_module )
module_Unneed( id->pp_ufilter[i], id->pp_ufilter[i]->p_module );
vlc_object_destroy( id->pp_ufilter[i] );
vlc_object_release( id->pp_ufilter[i] );
}
}
......@@ -2110,7 +2110,7 @@ static void transcode_video_close( sout_stream_t *p_stream,
id->pp_filter[i]->p_owner->pp_pics[j] );
}
free( id->pp_filter[i]->p_owner );
vlc_object_destroy( id->pp_filter[i] );
vlc_object_release( id->pp_filter[i] );
id->pp_filter[i] = NULL;
}
......@@ -2128,7 +2128,7 @@ static void transcode_video_close( sout_stream_t *p_stream,
id->pp_ufilter[i]->p_owner->pp_pics[j] );
}
free( id->pp_ufilter[i]->p_owner );
vlc_object_destroy( id->pp_ufilter[i] );
vlc_object_release( id->pp_ufilter[i] );
id->pp_ufilter[i] = NULL;
}
}
......@@ -2242,7 +2242,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
{
msg_Dbg( p_stream, "no video filter found" );
vlc_object_detach( id->pp_filter[id->i_filter] );
vlc_object_destroy( id->pp_filter[id->i_filter] );
vlc_object_release( id->pp_filter[id->i_filter] );
}
}
......@@ -2302,7 +2302,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
{
msg_Dbg( p_stream, "no video filter found" );
vlc_object_detach( id->pp_filter[id->i_filter] );
vlc_object_destroy( id->pp_filter[id->i_filter] );
vlc_object_release( id->pp_filter[id->i_filter] );
p_pic->pf_release( p_pic );
transcode_video_close( p_stream, id );
......@@ -2341,7 +2341,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
{
msg_Dbg( p_stream, "no video filter found" );
vlc_object_detach( id->pp_ufilter[id->i_ufilter] );
vlc_object_destroy( id->pp_ufilter[id->i_ufilter] );
vlc_object_release( id->pp_ufilter[id->i_ufilter] );
id->pp_ufilter[id->i_ufilter] = NULL;
}
}
......
......@@ -51,7 +51,7 @@ CThread::~CThread(void)
vlc_mutex_destroy( &m_TerminateLock );
vlc_cond_destroy( &m_TerminateCond );
vlc_object_detach(m_pAtmoThread);
vlc_object_destroy(m_pAtmoThread);
vlc_object_release(m_pAtmoThread);
}
}
......
......@@ -942,7 +942,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
VLC_FALSE ) )
{
msg_Err( p_filter, "cannot create FadeToColorThread" );
vlc_object_destroy( p_sys->p_fadethread );
vlc_object_release( p_sys->p_fadethread );
p_sys->p_fadethread = NULL;
vlc_mutex_unlock( &p_sys->filter_lock );
......@@ -953,7 +953,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
/* wait for the thread... */
vlc_thread_join(p_sys->p_fadethread);
vlc_object_destroy(p_sys->p_fadethread);
vlc_object_release(p_sys->p_fadethread);
p_sys->p_fadethread = NULL;
}
......@@ -1841,7 +1841,7 @@ static void CheckAndStopFadeThread(filter_t *p_filter)
vlc_thread_join(p_sys->p_fadethread);
vlc_object_destroy(p_sys->p_fadethread);
vlc_object_release(p_sys->p_fadethread);
p_sys->p_fadethread = NULL;
}
vlc_mutex_unlock( &p_sys->filter_lock );
......@@ -1897,7 +1897,7 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
VLC_FALSE) )
{
msg_Err( p_filter, "cannot create FadeToColorThread" );
vlc_object_destroy( p_sys->p_fadethread );
vlc_object_release( p_sys->p_fadethread );
p_sys->p_fadethread = NULL;
}
}
......
......@@ -417,7 +417,7 @@ static int Init( vout_thread_t *p_vout )
{
msg_Err( p_vout, "can't open blending filter, aborting" );
vlc_object_detach( p_sys->p_blend );
vlc_object_destroy( p_sys->p_blend );
vlc_object_release( p_sys->p_blend );
return VLC_EGENERIC;
}
......@@ -498,7 +498,7 @@ static void End( vout_thread_t *p_vout )
if( p_sys->p_blend->p_module )
module_Unneed( p_sys->p_blend, p_sys->p_blend->p_module );
vlc_object_detach( p_sys->p_blend );
vlc_object_destroy( p_sys->p_blend );
vlc_object_release( p_sys->p_blend );
}
/*****************************************************************************
......
......@@ -343,7 +343,7 @@ static int Init( vout_thread_t *p_vout )
msg_Err( p_vout, "can't open internal opencv filter: %s", p_vout->p_sys->psz_inner_name );
p_vout->p_sys->psz_inner_name = NULL;
vlc_object_detach( p_sys->p_opencv );
vlc_object_destroy( p_sys->p_opencv );
vlc_object_release( p_sys->p_opencv );
p_sys->p_opencv = NULL;
}
......@@ -389,7 +389,7 @@ static void End( vout_thread_t *p_vout )
if( p_vout->p_sys->p_opencv->p_module )
module_Unneed( p_vout->p_sys->p_opencv, p_vout->p_sys->p_opencv->p_module );
vlc_object_detach( p_vout->p_sys->p_opencv );
vlc_object_destroy( p_vout->p_sys->p_opencv );
vlc_object_release( p_vout->p_sys->p_opencv );
p_vout->p_sys->p_opencv = NULL;
}
......
......@@ -206,7 +206,7 @@ static int OpenVideo( vlc_object_t *p_this )
E_(EventThread), 0, 1 ) )
{
msg_Err( p_vout, "cannot create Vout EventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
......@@ -282,7 +282,7 @@ static void CloseVideo( vlc_object_t *p_this )
}
vlc_thread_join( p_vout->p_sys->p_event );
vlc_object_destroy( p_vout->p_sys->p_event );
vlc_object_release( p_vout->p_sys->p_event );
}
vlc_mutex_destroy( &p_vout->p_sys->lock );
......
......@@ -281,7 +281,7 @@ static int OpenVideo( vlc_object_t *p_this )
E_(EventThread), 0, 1 ) )
{
msg_Err( p_vout, "cannot create Vout EventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
......@@ -505,7 +505,7 @@ static void CloseVideo( vlc_object_t *p_this )
}
vlc_thread_join( p_vout->p_sys->p_event );
vlc_object_destroy( p_vout->p_sys->p_event );
vlc_object_release( p_vout->p_sys->p_event );
}
vlc_mutex_destroy( &p_vout->p_sys->lock );
......
......@@ -138,7 +138,7 @@ static int OpenVideo( vlc_object_t *p_this )
E_(EventThread), 0, 1 ) )
{
msg_Err( p_vout, "cannot create Vout EventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
......@@ -237,7 +237,7 @@ static void CloseVideo( vlc_object_t *p_this )
}
vlc_thread_join( p_vout->p_sys->p_event );
vlc_object_destroy( p_vout->p_sys->p_event );
vlc_object_release( p_vout->p_sys->p_event );
}
vlc_mutex_destroy( &p_vout->p_sys->lock );
......
......@@ -251,7 +251,7 @@ static int OpenVideo ( vlc_object_t *p_this )
E_(EventThread), 0, 1 ) )
{
msg_Err( p_vout, "cannot create Vout EventThread" );
vlc_object_destroy( p_vout->p_sys->p_event );
vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
......@@ -325,7 +325,7 @@ static void CloseVideo ( vlc_object_t *p_this )
}
vlc_thread_join( p_vout->p_sys->p_event );
vlc_object_destroy( p_vout->p_sys->p_event );
vlc_object_release( p_vout->p_sys->p_event );
}
vlc_mutex_destroy( &p_vout->p_sys->lock );
......
......@@ -302,7 +302,7 @@ static int CreateVout( vlc_object_t *p_this )
{
msg_Warn( p_vout, "No OpenGL provider found" );
vlc_object_detach( p_sys->p_vout );
vlc_object_destroy( p_sys->p_vout );
vlc_object_release( p_sys->p_vout );
return VLC_ENOOBJ;
}
......@@ -574,7 +574,7 @@ static void DestroyVout( vlc_object_t *p_this )
module_Unneed( p_sys->p_vout, p_sys->p_vout->p_module );
vlc_object_detach( p_sys->p_vout );
vlc_object_destroy( p_sys->p_vout );
vlc_object_release( p_sys->p_vout );