Use vlc_object_kill(). Needs triple checking.
authorRémi Denis-Courmont <rem@videolan.org>
Sat, 19 May 2007 20:03:26 +0000 (20:03 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sat, 19 May 2007 20:03:26 +0000 (20:03 +0000)
This also seems to make the pre-existing Qt4 crash more obvious.

59 files changed:
include/vlc_objects.h
modules/access/dv.c
modules/access/dvdnav.c
modules/access/eyetv.c
modules/access_output/bonjour.c
modules/access_output/udp.c
modules/audio_output/alsa.c
modules/audio_output/directx.c
modules/audio_output/hd1000a.cpp
modules/audio_output/oss.c
modules/audio_output/waveout.c
modules/codec/ffmpeg/encoder.c
modules/control/dbus.c
modules/control/gestures.c
modules/control/hotkeys.c
modules/control/http/macro.c
modules/control/ntservice.c
modules/control/rc.c
modules/control/telnet.c
modules/demux/avi/avi.c
modules/demux/live555.cpp
modules/demux/mkv.cpp
modules/gui/beos/InterfaceWindow.cpp
modules/gui/macosx/intf.m
modules/gui/ncurses.c
modules/gui/pda/pda_callbacks.c
modules/gui/qnx/aout.c
modules/gui/qnx/vout.c
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/main_interface.cpp
modules/misc/dummy/input.c
modules/misc/rtsp.c
modules/misc/testsuite/test4.c
modules/video_output/caca.c
modules/video_output/fb.c
modules/video_output/ggi.c
modules/video_output/glide.c
modules/video_output/msw/direct3d.c
modules/video_output/msw/directx.c
modules/video_output/msw/glwin32.c
modules/video_output/msw/wingdi.c
modules/video_output/qte/qte.cpp
modules/video_output/sdl.c
modules/video_output/svgalib.c
modules/visualization/galaktos/plugin.c
modules/visualization/goom.c
src/input/decoder.c
src/input/demux.c
src/input/input.c
src/input/vlm.c
src/interface/interface.c
src/libvlc.c
src/misc/beos_specific.cpp
src/network/httpd.c
src/playlist/engine.c
src/playlist/services_discovery.c
src/playlist/thread.c
src/stream_output/announce.c
src/video_output/video_output.c

index f12c070..a906d51 100644 (file)
@@ -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) )
 
index 6dc1da4..8a5d637 100644 (file)
@@ -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 );
index c8d2b71..129939c 100644 (file)
@@ -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 );
 
index b8a5a0a..441246e 100644 (file)
@@ -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 );
index 81ef402..1f097c8 100644 (file)
@@ -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 );
     }
 
index 82dd9eb..351ba0f 100644 (file)
@@ -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 );
index f0b9817..d9547bb 100644 (file)
@@ -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;
 
index 54cc0e3..9c4e3d9 100644 (file)
@@ -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 );
index 3c21de8..4583cff 100644 (file)
@@ -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;
 
index 299a82b..27af193 100644 (file)
@@ -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;
 
index b21a2fc..b96a07a 100644 (file)
@@ -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 );
 
index 6b5ffe5..1b9833a 100644 (file)
@@ -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 );
index d985dc2..79918e0 100644 (file)
@@ -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;
 }
 
index d796919..e4070e7 100644 (file)
@@ -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):
index b8cf815..21738f3 100644 (file)
@@ -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 )
index ee09716..eb1c753 100644 (file)
@@ -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 */
index 7281cd5..4c6a5b8 100644 (file)
@@ -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 );
 }
 
 /*****************************************************************************
index ee65c7b..c440915 100644 (file)
@@ -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;
index 6266d70..b05ea5a 100644 (file)
@@ -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, ' ' ) )
index d479e34..ed29f9e 100644 (file)
@@ -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;
             }
         }
index 7ef5893..2295297 100644 (file)
@@ -370,7 +370,7 @@ error:
     if( p_sys->env ) p_sys->env->reclaim();
     if( p_sys->p_timeout )
     {
-        p_sys->p_timeout->b_die = VLC_TRUE;
+        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 );
@@ -409,7 +409,7 @@ static void Close( vlc_object_t *p_this )
     if( p_sys->env ) p_sys->env->reclaim();
     if( p_sys->p_timeout )
     {
-        p_sys->p_timeout->b_die = VLC_TRUE;
+        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 );
index 2877566..2c74a4c 100644 (file)
@@ -2610,8 +2610,7 @@ void demux_sys_t::StopUiThread()
 {
     if ( b_ui_hooked )
     {
-        p_ev->b_die = VLC_TRUE;
-
+        vlc_object_kill( p_ev );
         vlc_thread_join( p_ev );
         vlc_object_destroy( p_ev );
 
index a7faf92..7bd0eb1 100644 (file)
@@ -804,7 +804,7 @@ bool InterfaceWindow::QuitRequested()
 
      _StoreSettings();
 
-    p_intf->b_die = 1;
+    vlc_object_kill( p_intf );
 
     return( true );
 }
index f795acc..e7a6bad 100644 (file)
@@ -1717,7 +1717,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     /* write cached user defaults to disk */
     [[NSUserDefaults standardUserDefaults] synchronize];
 
-    p_intf->b_die = VLC_TRUE;
+    vlc_object_kill( p_intf );
 
     /* Go back to Run() and make libvlc exit properly */
     longjmp( jmpbuffer, 1 );
index 857db4f..19b0650 100644 (file)
@@ -839,7 +839,7 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
         case 'q':
         case 'Q':
         case 0x1b:  /* Esc */
-            p_intf->p_libvlc->b_die = VLC_TRUE;
+            vlc_object_kill( p_intf->p_libvlc );
             return 0;
 
         /* Box switching */
index 9bab5be..a4e3a1a 100644 (file)
@@ -343,7 +343,7 @@ gboolean onPDADeleteEvent(GtkWidget *widget, GdkEvent *event, gpointer user_data
     intf_thread_t *p_intf = GtkGetIntf( widget );
 
     vlc_mutex_lock( &p_intf->change_lock );
-    p_intf->p_libvlc->b_die = VLC_TRUE;
+    vlc_object_kill( p_intf->p_libvlc );
     vlc_mutex_unlock( &p_intf->change_lock );
     msg_Dbg( p_intf, "about to exit vlc ... signaled" );
 
index 3f40512..f9b2e2f 100644 (file)
@@ -242,7 +242,7 @@ void E_(CloseAudio) ( vlc_object_t *p_this )
     aout_instance_t *p_aout = (aout_instance_t *)p_this;
     int i_ret;
 
-    p_aout->b_die = 1;
+    vlc_object_kill( p_aout );
     vlc_thread_join( p_aout );
 
     if( ( i_ret = snd_pcm_close( p_aout->output.p_sys->p_pcm_handle ) ) < 0 )
index 6c274ab..95935f6 100644 (file)
@@ -299,7 +299,7 @@ static int QNXManage( vout_thread_t *p_vout )
     PhEvent_t *p_event;
     vlc_bool_t b_repos = 0;
 
-    if (p_vout->b_die == 1)
+    if (p_vout->b_die)
     {
         return ( 0 );
     }
@@ -338,7 +338,7 @@ static int QNXManage( vout_thread_t *p_vout )
                 switch( p_ev->event_f )
                 {
                 case Ph_WM_CLOSE:
-                    p_vout->p_libvlc->b_die = 1;
+                    p_vout->p_libvlc->b_die = VLC_TRUE;
                     break;
 
                 case Ph_WM_MOVE:
@@ -368,7 +368,7 @@ static int QNXManage( vout_thread_t *p_vout )
                     {
                     case Pk_q:
                     case Pk_Q:
-                        p_vout->p_libvlc->b_die = 1;
+                        p_vout->p_libvlc->b_die = VLC_TRUE;
                         break;
 
                     case Pk_f:
index 706d491..a2c78a1 100644 (file)
@@ -71,7 +71,7 @@ DialogsProvider::~DialogsProvider()
 
 void DialogsProvider::quit()
 {
-    p_intf->b_die = VLC_TRUE;
+    vlc_object_kill( p_intf );
     QApplication::quit();
 }
 
index b6398fa..f4600ef 100644 (file)
@@ -857,7 +857,7 @@ void MainInterface::updateOnTimer()
 void MainInterface::closeEvent( QCloseEvent *e )
 {
     hide();
-    p_intf->b_die = VLC_TRUE;
+    vlc_object_kill( p_intf );
 }
 
 void MainInterface::updateVolume( int sliderVolume )
index a2ee8c5..7725145 100644 (file)
@@ -213,7 +213,8 @@ static int Demux( demux_t *p_demux )
     switch( p_sys->i_command )
     {
         case COMMAND_QUIT:
-            b_eof = p_demux->p_libvlc->b_die = VLC_TRUE;
+            b_eof = VLC_TRUE;
+            vlc_object_kill( p_demux->p_libvlc );
             break;
 
         case COMMAND_PAUSE:
index 6a54f40..99b3cde 100644 (file)
@@ -324,7 +324,7 @@ static void Close( vlc_object_t * p_this )
     vod_sys_t *p_sys = p_vod->p_sys;
 
     /* Stop command thread */
-    p_vod->b_die = VLC_TRUE;
+    vlc_object_kill( p_vod );
     CommandPush( p_vod, RTSP_CMD_TYPE_NONE, NULL, NULL, 0.0, NULL );
     vlc_thread_join( p_vod );
 
index 891d270..addf437 100644 (file)
@@ -175,7 +175,7 @@ static int Callback( vlc_object_t *p_this, char const *psz_cmd,
 
     for( i = 0; i < 10; i++ )
     {
-        pp_objects[i]->b_die = VLC_TRUE;
+        vlc_object_kill( pp_objects[i] );
         vlc_thread_join( pp_objects[i] );
         vlc_object_detach( pp_objects[i] );
         vlc_object_destroy( pp_objects[i] );
index c4d3733..20ded4f 100644 (file)
@@ -359,7 +359,7 @@ static int Manage( vout_thread_t *p_vout )
                 playlist_Stop( p_playlist );
                 vlc_object_release( p_playlist );
             }
-            p_vout->p_libvlc->b_die = VLC_TRUE;
+            vlc_object_kill( p_vout->p_libvlc );
             break;
         }
 #endif
index b645ead..3a268c2 100644 (file)
@@ -381,7 +381,7 @@ static int Manage( vout_thread_t *p_vout )
         switch( buf )
         {
         case 'q':
-            p_vout->p_libvlc->b_die = 1;
+            vlc_object_kill( p_vout->p_libvlc );
             break;
 
         default:
index c1a672f..37a98ee 100644 (file)
@@ -293,7 +293,7 @@ static int Manage( vout_thread_t *p_vout )
                     case 'q':
                     case 'Q':
                     case GIIUC_Escape:
-                        p_vout->p_libvlc->b_die = 1;
+                        vlc_object_kill( p_vout->p_libvlc );
                         break;
 
                     default:
index 1667b86..42f4b18 100644 (file)
@@ -207,7 +207,7 @@ static int Manage( vout_thread_t *p_vout )
         switch( (char)buf )
         {
         case 'q':
-            p_vout->p_libvlc->b_die = 1;
+            vlc_object_kill( p_vout->p_libvlc );
             break;
 
         default:
index ad26bbb..8b50681 100644 (file)
@@ -270,7 +270,7 @@ static void CloseVideo( vlc_object_t *p_this )
         vlc_object_detach( p_vout->p_sys->p_event );
 
         /* Kill Vout EventThread */
-        p_vout->p_sys->p_event->b_die = VLC_TRUE;
+        vlc_object_kill( p_vout->p_sys->p_event );
 
         /* we need to be sure Vout EventThread won't stay stuck in
          * GetMessage, so we send a fake message */
index e6500b7..19930ab 100644 (file)
@@ -493,7 +493,7 @@ static void CloseVideo( vlc_object_t *p_this )
         vlc_object_detach( p_vout->p_sys->p_event );
 
         /* Kill Vout EventThread */
-        p_vout->p_sys->p_event->b_die = VLC_TRUE;
+        vlc_object_kill( p_vout->p_sys->p_event );
 
         /* we need to be sure Vout EventThread won't stay stuck in
          * GetMessage, so we send a fake message */
index b2549fa..e07bc85 100644 (file)
@@ -225,7 +225,7 @@ static void CloseVideo( vlc_object_t *p_this )
         vlc_object_detach( p_vout->p_sys->p_event );
 
         /* Kill Vout EventThread */
-        p_vout->p_sys->p_event->b_die = VLC_TRUE;
+        vlc_object_kill( p_vout->p_sys->p_event );
 
         /* we need to be sure Vout EventThread won't stay stuck in
          * GetMessage, so we send a fake message */
index ba2367b..ab5af69 100755 (executable)
@@ -313,7 +313,7 @@ static void CloseVideo ( vlc_object_t *p_this )
         vlc_object_detach( p_vout->p_sys->p_event );
 
         /* Kill Vout EventThread */
-        p_vout->p_sys->p_event->b_die = VLC_TRUE;
+        vlc_object_kill( p_vout->p_sys->p_event );
 
         /* we need to be sure Vout EventThread won't stay stuck in
          * GetMessage, so we send a fake message */
index 33cd849..1f4e9db 100644 (file)
@@ -185,7 +185,7 @@ static void Close ( vlc_object_t *p_this )
         vlc_object_detach( p_vout->p_sys->p_event );
 
         /* Kill RunQtThread */
-        p_vout->p_sys->p_event->b_die = VLC_TRUE;
+        vlc_object_kill( p_vout->p_sys->p_event );
         CloseDisplay(p_vout);
 
         vlc_thread_join( p_vout->p_sys->p_event );
index a542fab..48f8f4a 100644 (file)
@@ -423,7 +423,7 @@ static int Manage( vout_thread_t *p_vout )
             break;
 
         case SDL_QUIT:
-            p_vout->p_libvlc->b_die = 1;
+            vlc_object_kill( p_vout->p_libvlc );
             break;
 
         case SDL_KEYDOWN:                             /* if a key is pressed */
@@ -437,12 +437,12 @@ static int Manage( vout_thread_t *p_vout )
                 }
                 else
                 {
-                    p_vout->p_libvlc->b_die = 1;
+                    vlc_object_kill( p_vout->p_libvlc );
                 }
                 break;
 
             case SDLK_q:                                             /* quit */
-                p_vout->p_libvlc->b_die = 1;
+                vlc_object_kill( p_vout->p_libvlc );
                 break;
 
             case SDLK_f:                             /* switch to fullscreen */
index efd62e5..454ba49 100644 (file)
@@ -231,7 +231,7 @@ static int Manage( vout_thread_t *p_vout )
     if( keyboard_keypressed(SCANCODE_ESCAPE)
          || keyboard_keypressed(SCANCODE_Q ) )
     {
-        p_vout->p_libvlc->b_die = VLC_TRUE;
+        vlc_object_kill( p_vout->p_libvlc );
     }
 
     return VLC_SUCCESS;
index 6c44dde..7d8327e 100644 (file)
@@ -245,7 +245,7 @@ static void Thread( vlc_object_t *p_this )
         mspf = 1000 / 60;
         if( galaktos_update( p_thread ) == 1 )
         {
-            p_thread->b_die = 1;
+            vlc_object_kill( p_thread );
         }
         if( p_thread->psz_title )
         {
@@ -282,7 +282,7 @@ static void Close( vlc_object_t *p_this )
     aout_filter_sys_t *p_sys = p_filter->p_sys;
 
     /* Stop galaktos Thread */
-    p_sys->p_thread->b_die = VLC_TRUE;
+    vlc_object_kill( p_sys->p_thread );
 
     galaktos_done( p_sys->p_thread );
 
index 888aeaa..694f1a3 100644 (file)
@@ -384,7 +384,7 @@ static void Close( vlc_object_t *p_this )
     aout_filter_sys_t *p_sys = p_filter->p_sys;
 
     /* Stop Goom 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 );
index 37192a4..d5499a6 100644 (file)
@@ -191,7 +191,7 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
  */
 void input_DecoderDelete( decoder_t *p_dec )
 {
-    p_dec->b_die = VLC_TRUE;
+    vlc_object_kill( p_dec );
 
     if( p_dec->p_owner->b_own_thread )
     {
index 8a31734..f005282 100644 (file)
@@ -359,8 +359,9 @@ void stream_DemuxDelete( stream_t *s )
     d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys;
     block_t *p_empty;
 
-    s->b_die = VLC_TRUE;
-    if( p_sys->p_demux ) p_sys->p_demux->b_die = VLC_TRUE;
+    vlc_object_kill( s );
+    if( p_sys->p_demux )
+        vlc_object_kill( p_sys->p_demux );
     p_empty = block_New( s, 1 ); p_empty->i_buffer = 0;
     block_FifoPut( p_sys->p_fifo, p_empty );
     vlc_thread_join( s );
@@ -534,7 +535,7 @@ static int DStreamThread( stream_t *s )
         if( p_demux->pf_demux( p_demux ) <= 0 ) break;
     }
 
-    p_demux->b_die = VLC_TRUE;
+    vlc_object_kill( p_demux );
     return VLC_SUCCESS;
 }
 
index f79b415..570bb8d 100644 (file)
@@ -417,7 +417,8 @@ void input_StopThread( input_thread_t *p_input )
     int i;
 
     /* Set die for input */
-    p_input->b_die = VLC_TRUE;
+    vlc_object_kill( p_input );
+    /* FIXME: seems to be duplicated in ControlPush(INPUT_CONTROL_SET_DIE) */
 
     /* We cannot touch p_input fields directly (we come from another thread),
      * so use the vlc_object_find way, it's perfectly safe */
@@ -426,7 +427,7 @@ void input_StopThread( input_thread_t *p_input )
     p_list = vlc_list_find( p_input, VLC_OBJECT_ACCESS, FIND_CHILD );
     for( i = 0; i < p_list->i_count; i++ )
     {
-        p_list->p_values[i].p_object->b_die = VLC_TRUE;
+        vlc_object_kill( p_list->p_values[i].p_object );
     }
     vlc_list_release( p_list );
 
@@ -434,7 +435,7 @@ void input_StopThread( input_thread_t *p_input )
     p_list = vlc_list_find( p_input, VLC_OBJECT_STREAM, FIND_CHILD );
     for( i = 0; i < p_list->i_count; i++ )
     {
-        p_list->p_values[i].p_object->b_die = VLC_TRUE;
+        vlc_object_kill( p_list->p_values[i].p_object );
     }
     vlc_list_release( p_list );
 
@@ -442,7 +443,7 @@ void input_StopThread( input_thread_t *p_input )
     p_list = vlc_list_find( p_input, VLC_OBJECT_DEMUX, FIND_CHILD );
     for( i = 0; i < p_list->i_count; i++ )
     {
-        p_list->p_values[i].p_object->b_die = VLC_TRUE;
+        vlc_object_kill( p_list->p_values[i].p_object );
     }
     vlc_list_release( p_list );
 
@@ -1452,12 +1453,12 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type,
             msg_Dbg( p_input, "control: stopping input" );
             /* Mark all submodules to die */
             if( p_input->p->input.p_access )
-                p_input->p->input.p_access->b_die = VLC_TRUE;
+                vlc_object_kill( p_input->p->input.p_access );
             if( p_input->p->input.p_stream )
-                p_input->p->input.p_stream->b_die = VLC_TRUE;
-            p_input->p->input.p_demux->b_die = VLC_TRUE;
+                vlc_object_kill( p_input->p->input.p_stream );
+            vlc_object_kill( p_input->p->input.p_demux );
 
-            p_input->b_die = VLC_TRUE;
+            vlc_object_kill( p_input );
             break;
 
         case INPUT_CONTROL_SET_POSITION:
index 296a5ad..1004735 100644 (file)
@@ -174,7 +174,7 @@ void vlm_Delete( vlm_t *p_vlm )
         return;
     }
 
-    p_vlm->b_die = VLC_TRUE;
+    vlc_object_kill( p_vlm );
     vlc_thread_join( p_vlm );
 
     vlc_object_detach( p_vlm );
index 2fc988d..726b21c 100644 (file)
@@ -171,7 +171,7 @@ int intf_RunThread( intf_thread_t *p_intf )
             while( !intf_ShouldDie( p_intf ) )
                 msleep( INTF_IDLE_SLEEP * 2);
         }
-        p_intf->b_die = VLC_TRUE;
+        vlc_object_kill( p_intf );
     }
     else
 #endif
@@ -196,7 +196,7 @@ int intf_RunThread( intf_thread_t *p_intf )
             while( !intf_ShouldDie( p_intf ) )
                 msleep( INTF_IDLE_SLEEP * 2);
         }
-        p_intf->b_die = VLC_TRUE;
+        vlc_object_kill( p_intf );
     }
     else
     {
@@ -237,7 +237,7 @@ void intf_StopThread( intf_thread_t *p_intf )
     /* Tell the interface to die */
     if( !p_intf->b_block )
     {
-        p_intf->b_die = VLC_TRUE;
+        vlc_object_kill( p_intf );
         if( p_intf->pf_run )
         {
             vlc_cond_signal( &p_intf->object_wait );
@@ -385,7 +385,7 @@ static void RunInterface( intf_thread_t *p_intf )
         p_intf->psz_switch_intf = NULL;
 
         vlc_mutex_lock( &p_intf->object_lock );
-        p_intf->b_die = VLC_FALSE;
+        p_intf->b_die = VLC_FALSE; /* FIXME */
         p_intf->b_dead = VLC_FALSE;
         vlc_mutex_unlock( &p_intf->object_lock );
 
@@ -404,7 +404,7 @@ static int SwitchIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
     p_intf->psz_switch_intf =
         malloc( strlen(newval.psz_string) + sizeof(",none") );
     sprintf( p_intf->psz_switch_intf, "%s,none", newval.psz_string );
-    p_intf->b_die = VLC_TRUE;
+    vlc_object_kill( p_intf );
 
     return VLC_SUCCESS;
 }
@@ -453,7 +453,7 @@ static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
 
 - (void)terminate: (id)sender
 {
-    o_libvlc->b_die = VLC_TRUE;
+    vlc_object_kill( o_libvlc );
     [super terminate: sender];
 }
 
index 8cd109e..1e45824 100644 (file)
@@ -155,7 +155,7 @@ int VLC_AddIntf( int i_object, char const *psz_module,
 int VLC_Die( int i_object )
 {
     LIBVLC_FUNC;
-    p_libvlc->b_die = VLC_TRUE;
+    vlc_object_kill( p_libvlc );
     LIBVLC_FUNC_END;
     return VLC_SUCCESS;
 }
index e9a5378..610accb 100644 (file)
@@ -233,7 +233,7 @@ bool VlcApplication::QuitRequested()
 {
     if( !fReadyToQuit )
     {
-        p_this->p_libvlc->b_die = 1;
+        vlc_object_kill( p_this->p_libvlc );
         return false;
     }
 
index 68a4c4e..cd38458 100644 (file)
@@ -1151,7 +1151,7 @@ void httpd_HostDelete( httpd_host_t *host )
     }
     TAB_REMOVE( httpd->i_host, httpd->host, host );
 
-    host->b_die = 1;
+    vlc_object_kill( host );
     vlc_thread_join( host );
 
     msg_Dbg( host, "HTTP host removed" );
index 1ed3ec4..9a259d0 100644 (file)
@@ -331,7 +331,7 @@ check_input:
                 if( b_playexit == VLC_TRUE )
                 {
                     msg_Info( p_playlist, "end of playlist, exiting" );
-                    p_playlist->p_libvlc->b_die = VLC_TRUE;
+                    vlc_object_kill( p_playlist->p_libvlc );
                 }
                 p_playlist->status.i_status = PLAYLIST_STOPPED;
                 PL_UNLOCK
index 6fe6fa3..89e2275 100644 (file)
@@ -66,7 +66,7 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist,  const char *psz_modu
             continue;
         }
         p_sd->psz_module = strdup( psz_plugin );
-        p_sd->b_die = VLC_FALSE;
+        p_sd->b_die = VLC_FALSE; /* FIXME */
 
         PL_LOCK;
         TAB_APPEND( p_playlist->i_sds, p_playlist->pp_sds, p_sd );
@@ -102,25 +102,22 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
             break;
         }
     }
+    PL_UNLOCK;
 
     if( p_sd )
     {
-        PL_UNLOCK;
-        p_sd->b_die = VLC_TRUE;
+        vlc_object_kill( p_sd );
         if( p_sd->pf_run ) vlc_thread_join( p_sd );
 
         free( p_sd->psz_module );
         module_Unneed( p_sd, p_sd->p_module );
-        PL_LOCK;
         vlc_object_destroy( p_sd );
     }
     else
     {
         msg_Warn( p_playlist, "module %s is not loaded", psz_module );
-        PL_UNLOCK;
         return VLC_EGENERIC;
     }
-    PL_UNLOCK;
     return VLC_SUCCESS;
 }
 
index 42df00d..360cd66 100644 (file)
@@ -137,7 +137,7 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
 int playlist_ThreadDestroy( playlist_t * p_playlist )
 {
     // Tell playlist to go to last loop
-    p_playlist->b_die = VLC_TRUE;
+    vlc_object_kill( p_playlist );
     playlist_Signal( p_playlist );
 
     // Kill preparser
index e7950f9..59a96e9 100644 (file)
@@ -298,7 +298,7 @@ int announce_HandlerDestroy( announce_handler_t *p_announce )
 {
     if( p_announce->p_sap )
     {
-        ((vlc_object_t *)p_announce->p_sap)->b_die = VLC_TRUE;
+        vlc_object_kill ((vlc_object_t *)p_announce->p_sap);
         /* Wait for the SAP thread to exit */
         vlc_thread_join( (vlc_object_t *)p_announce->p_sap );
         announce_SAPHandlerDestroy( p_announce->p_sap );
index cdb156d..5c68726 100644 (file)
@@ -461,8 +461,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
         msg_Err( p_vout, "video output creation failed" );
 
         /* Make sure the thread is destroyed */
-        p_vout->b_die = VLC_TRUE;
-
+        vlc_object_kill( p_vout );
         vlc_thread_join( p_vout );
 
         vlc_object_detach( p_vout );
@@ -487,7 +486,7 @@ void vout_Destroy( vout_thread_t *p_vout )
     playlist_t *p_playlist = pl_Yield( p_vout );
 
     /* Request thread destruction */
-    p_vout->b_die = VLC_TRUE;
+    vlc_object_kill( p_vout );
     vlc_thread_join( p_vout );
 
     var_Destroy( p_vout, "intf-change" );