Commit 9025fab9 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Use vlc_object_kill(). Needs triple checking.

This also seems to make the pre-existing Qt4 crash more obvious.
parent bc387d3d
......@@ -119,6 +119,9 @@ VLC_EXPORT( libvlc_int_t *, vlc_current_object, ( int ) );
__vlc_object_destroy( VLC_OBJECT(a) ); \
(a) = NULL; } while(0)
#define vlc_object_kill(a) \
__vlc_object_kill( VLC_OBJECT(a) )
#define vlc_object_detach(a) \
__vlc_object_detach( VLC_OBJECT(a) )
......
......@@ -252,7 +252,7 @@ static void Close( vlc_object_t *p_this )
if( p_sys->p_ev )
{
/* stop the event handler */
p_sys->p_ev->b_die = VLC_TRUE;
vlc_object_kill( p_sys->p_ev );
if( p_sys->p_raw1394 )
raw1394_stop_iso_rcv( p_sys->p_raw1394, p_sys->i_channel );
......
......@@ -352,7 +352,7 @@ static void Close( vlc_object_t *p_this )
int i;
/* stop the event handler */
p_sys->p_ev->b_die = VLC_TRUE;
vlc_object_kill( p_sys->p_ev );
vlc_thread_join( p_sys->p_ev );
vlc_object_destroy( p_sys->p_ev );
......
......@@ -179,7 +179,7 @@ static void Close( vlc_object_t *p_this )
msg_Dbg( p_access, "plugin notified" );
/* stop receiver thread */
p_sys->p_thread->b_die = VLC_TRUE;
vlc_object_kill( p_sys->p_thread );
vlc_mutex_lock( &p_sys->p_thread->lock );
vlc_cond_signal( &p_sys->p_thread->wait );
vlc_mutex_unlock( &p_sys->p_thread->lock );
......
......@@ -291,7 +291,7 @@ void bonjour_stop_service( void *_p_sys )
if( p_sys->poll_thread->b_thread )
{
p_sys->poll_thread->b_die = 1;
vlc_object_kill( p_sys->poll_thread );
vlc_thread_join( p_sys->poll_thread );
}
......
......@@ -419,7 +419,7 @@ static void Close( vlc_object_t * p_this )
sout_access_out_sys_t *p_sys = p_access->p_sys;
int i;
p_sys->p_thread->b_die = 1;
vlc_object_kill( p_sys->p_thread );
for( i = 0; i < 10; i++ )
{
block_t *p_dummy = block_New( p_access, p_sys->i_mtu );
......
......@@ -725,7 +725,7 @@ static void Close( vlc_object_t *p_this )
vlc_cond_signal( &p_aout->output.p_sys->wait );
vlc_mutex_unlock( &p_aout->output.p_sys->lock );
p_aout->b_die = VLC_TRUE;
vlc_object_kill( p_aout );
vlc_thread_join( p_aout );
p_aout->b_die = VLC_FALSE;
......
......@@ -589,7 +589,7 @@ static void CloseAudio( vlc_object_t *p_this )
vlc_object_detach( p_sys->p_notif );
if( p_sys->p_notif->b_thread )
{
p_sys->p_notif->b_die = 1;
vlc_object_kill( p_sys->p_notif );
/* wake up the audio thread if needed */
if( !p_sys->b_playing ) SetEvent( p_sys->p_notif->event );
......
......@@ -192,7 +192,7 @@ static void Close( vlc_object_t * p_this )
aout_instance_t * p_aout = (aout_instance_t *)p_this;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
p_aout->b_die = VLC_TRUE;
vlc_object_kill( p_aout );
vlc_thread_join( p_aout );
p_aout->b_die = VLC_FALSE;
......
......@@ -541,7 +541,7 @@ static void Close( vlc_object_t * p_this )
aout_instance_t *p_aout = (aout_instance_t *)p_this;
struct aout_sys_t * p_sys = p_aout->output.p_sys;
p_aout->b_die = VLC_TRUE;
vlc_object_kill( p_aout );
vlc_thread_join( p_aout );
p_aout->b_die = VLC_FALSE;
......
......@@ -486,7 +486,7 @@ static void Close( vlc_object_t *p_this )
aout_sys_t *p_sys = p_aout->output.p_sys;
/* Before calling waveOutClose we must reset the device */
p_aout->b_die = VLC_TRUE;
vlc_object_kill( p_aout );
waveOutReset( p_sys->h_waveout );
......
......@@ -1014,7 +1014,7 @@ void E_(CloseEncoder)( vlc_object_t *p_this )
(struct thread_context_t **)p_sys->p_context->thread_opaque;
for ( i = 0; i < p_enc->i_threads; i++ )
{
pp_contexts[i]->b_die = 1;
vlc_object_kill( pp_contexts[i] );
vlc_cond_signal( &pp_contexts[i]->cond );
vlc_thread_join( pp_contexts[i] );
vlc_mutex_destroy( &pp_contexts[i]->lock );
......
......@@ -157,7 +157,7 @@ DBUS_METHOD( Quit )
playlist_t *p_playlist = pl_Yield( (vlc_object_t*) p_this );
playlist_Stop( p_playlist );
pl_Release( ((vlc_object_t*) p_this) );
((vlc_object_t*)p_this)->p_libvlc->b_die = VLC_TRUE;
vlc_object_kill(((vlc_object_t*)p_this)->p_libvlc);
REPLY_SEND;
}
......
......@@ -422,7 +422,7 @@ static void RunIntf( intf_thread_t *p_intf )
break;
case GESTURE(DOWN,LEFT,NONE,NONE):
/* FIXME: Should close the vout!"*/
p_intf->p_libvlc->b_die = VLC_TRUE;
vlc_object_kill( p_intf->p_libvlc );
break;
case GESTURE(DOWN,LEFT,UP,RIGHT):
case GESTURE(UP,RIGHT,DOWN,LEFT):
......
......@@ -236,7 +236,7 @@ static void Run( intf_thread_t *p_intf )
if( i_action == ACTIONID_QUIT )
{
p_intf->p_libvlc->b_die = VLC_TRUE;
vlc_object_kill( p_intf->p_libvlc );
ClearChannels( p_intf, p_vout );
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Quit" ) );
if( p_vout )
......
......@@ -518,7 +518,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
case MVLC_SHUTDOWN:
{
msg_Dbg( p_intf, "requested shutdown" );
p_intf->p_libvlc->b_die = VLC_TRUE;
vlc_object_kill( p_intf->p_libvlc );
break;
}
/* vlm */
......
......@@ -164,7 +164,7 @@ static void Run( intf_thread_t *p_intf )
}
/* Make sure we exit (In case other interfaces have been spawned) */
p_intf->p_libvlc->b_die = VLC_TRUE;
vlc_object_kill( p_intf->p_libvlc );
}
/*****************************************************************************
......
......@@ -457,7 +457,7 @@ static void Run( intf_thread_t *p_intf )
if( p_intf->p_sys->hConsoleIn == INVALID_HANDLE_VALUE )
{
msg_Err( p_intf, "couldn't find user input handle" );
p_intf->b_die = VLC_TRUE;
vlc_object_kill( p_intf );
}
#endif
......@@ -1447,7 +1447,7 @@ static int Quit( vlc_object_t *p_this, char const *psz_cmd,
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
p_this->p_libvlc->b_die = VLC_TRUE;
vlc_object_kill( p_this->p_libvlc );
return VLC_SUCCESS;
}
......@@ -1962,7 +1962,7 @@ vlc_bool_t ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
}
else
/* Standard input closed: exit */
p_intf->b_die = VLC_TRUE;
vlc_object_kill( p_intf );
p_buffer[ *pi_size ] = 0;
return VLC_TRUE;
......
......@@ -432,7 +432,7 @@ static void Run( intf_thread_t *p_intf )
else if( !strncmp( cl->buffer_read, "shutdown", 8 ) )
{
msg_Err( p_intf, "shutdown requested" );
p_intf->p_libvlc->b_die = VLC_TRUE;
vlc_object_kill( p_intf->p_libvlc );
}
else if( *cl->buffer_read == '@'
&& strchr( cl->buffer_read, ' ' ) )
......
......@@ -594,7 +594,7 @@ aviindex:
else if( i_create == DIALOG_CANCELLED )
{
/* Kill input */
p_demux->p_parent->b_die = VLC_TRUE;
vlc_object_kill( p_demux->p_parent );
goto error;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment