Remove intf_ShouldDie
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 14 Sep 2008 08:14:24 +0000 (11:14 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 14 Sep 2008 08:14:24 +0000 (11:14 +0300)
libvlc kills the interfaces when it dies anyway.

13 files changed:
include/vlc_interface.h
modules/control/gestures.c
modules/control/lirc.c
modules/control/netsync.c
modules/control/rc.c
modules/control/showintf.c
modules/gui/beos/Interface.cpp
modules/gui/fbosd.c
modules/gui/ncurses.c
modules/gui/pda/pda.c
modules/gui/qt4/main_interface.cpp
modules/gui/wince/timer.cpp
modules/gui/wxwidgets/timer.cpp

index 58b40b8..c24f7b9 100644 (file)
@@ -108,10 +108,6 @@ VLC_EXPORT( intf_thread_t *, __intf_Create,     ( vlc_object_t *, const char * )
 VLC_EXPORT( int,               intf_RunThread,  ( intf_thread_t * ) );
 VLC_EXPORT( void,              intf_StopThread, ( intf_thread_t * ) );
 
-/* If the interface is in the main thread, it should listen both to
- * p_intf->b_die and p_libvlc->b_die */
-#define intf_ShouldDie( p_intf ) (p_intf->b_die || p_intf->p_libvlc->b_die )
-
 #define intf_Eject(a,b) __intf_Eject(VLC_OBJECT(a),b)
 VLC_EXPORT( int, __intf_Eject, ( vlc_object_t *, const char * ) );
 
index e849d0d..d0bb029 100644 (file)
@@ -182,7 +182,7 @@ static void RunIntf( intf_thread_t *p_intf )
     msg_Dbg( p_intf, "interface thread initialized" );
 
     /* Main loop */
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         vlc_mutex_lock( &p_intf->change_lock );
 
@@ -461,7 +461,7 @@ static int InitThread( intf_thread_t * p_intf )
 {
     char *psz_button;
     /* we might need some locking here */
-    if( !intf_ShouldDie( p_intf ) )
+    if( vlc_object_alive( p_intf ) )
     {
         /* p_intf->change_lock locking strategy:
          * - Every access to p_intf->p_sys are locked threw p_intf->change_lock
index 63f4e4f..c82dcc5 100644 (file)
@@ -175,7 +175,7 @@ static int Process( intf_thread_t *p_intf )
         if( code == NULL )
             return 0;
 
-        while( !intf_ShouldDie( p_intf )
+        while( vlc_object_alive( p_intf )
                 && (lirc_code2char( p_intf->p_sys->config, code, &c ) == 0)
                 && (c != NULL) )
         {
index 1062548..11f59c7 100644 (file)
@@ -150,7 +150,7 @@ static void Run( intf_thread_t *p_intf )
     /* High priority thread */
     vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_INPUT );
 
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         /* Update the input */
         if( p_input == NULL )
index ad6150a..448ebf4 100644 (file)
@@ -479,7 +479,7 @@ static void Run( intf_thread_t *p_intf )
     }
 #endif
 
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         char *psz_cmd, *psz_arg;
         bool b_complete;
@@ -2050,7 +2050,7 @@ bool ReadWin32( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
     while( WaitForSingleObject( p_intf->p_sys->hConsoleIn,
                                 INTF_IDLE_SLEEP/1000 ) == WAIT_OBJECT_0 )
     {
-        while( !intf_ShouldDie( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
+        while( vlc_object_alive( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
                ReadConsoleInput( p_intf->p_sys->hConsoleIn, &input_record,
                                  1, &i_dw ) )
         {
@@ -2120,7 +2120,7 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
     }
 #endif
 
-    while( !intf_ShouldDie( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
+    while( vlc_object_alive( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
            (i_read = net_Read( p_intf, p_intf->p_sys->i_socket == -1 ?
                        0 /*STDIN_FILENO*/ : p_intf->p_sys->i_socket, NULL,
                   (uint8_t *)p_buffer + *pi_size, 1, false ) ) > 0 )
index d1360df..a59cad6 100644 (file)
@@ -121,7 +121,7 @@ static void RunIntf( intf_thread_t *p_intf )
     }
 
     /* Main loop */
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         vlc_mutex_lock( &p_intf->change_lock );
 
@@ -179,7 +179,7 @@ static void RunIntf( intf_thread_t *p_intf )
  *****************************************************************************/
 static int InitThread( intf_thread_t * p_intf )
 {
-    if( !intf_ShouldDie( p_intf ) )
+    if( vlc_object_alive( p_intf ) )
     {
         vlc_mutex_lock( &p_intf->change_lock );
 
index 859c618..c1c5f62 100644 (file)
@@ -120,7 +120,7 @@ void CloseIntf ( vlc_object_t *p_this )
  *****************************************************************************/
 static void Run( intf_thread_t *p_intf )
 {
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         p_intf->p_sys->p_window->UpdateInterface();
         msleep( INTF_IDLE_SLEEP );
index 4723fea..ef3de6d 100644 (file)
@@ -1272,7 +1272,7 @@ static void Run( intf_thread_t *p_intf )
     intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys;
     int canc = vlc_savecancel();
 
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         int i;
 
index 7b490c0..3ea7a9f 100644 (file)
@@ -404,7 +404,7 @@ static void Run( intf_thread_t *p_intf )
     var_AddCallback( p_playlist, "item-append", PlaylistChanged, p_intf );
     var_AddCallback( p_playlist, "item-change", PlaylistChanged, p_intf );
 
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         msleep( INTF_IDLE_SLEEP );
 
index 429a5f1..5776b67 100644 (file)
@@ -317,7 +317,7 @@ static void Run( intf_thread_t *p_intf )
 
 #ifdef NEED_GTK2_MAIN
     msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         Manage( p_intf );
 
@@ -516,14 +516,14 @@ static int Manage( intf_thread_t *p_intf )
         }
         vlc_object_unlock( p_input );
     }
-    else if( p_intf->p_sys->b_playing && !intf_ShouldDie( p_intf ) )
+    else if( p_intf->p_sys->b_playing && vlc_object_alive( p_intf ) )
     {
         GtkModeManage( p_intf );
         p_intf->p_sys->b_playing = 0;
     }
 
 #ifndef NEED_GTK2_MAIN
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
         vlc_mutex_unlock( &p_intf->change_lock );
 
index 608ff52..764222f 100644 (file)
@@ -924,7 +924,7 @@ void MainInterface::setRate( int rate )
 void MainInterface::updateOnTimer()
 {
     /* No event for dying */
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
         QApplication::closeAllWindows();
         QApplication::quit();
index fdacaf5..cdf2acf 100644 (file)
@@ -210,14 +210,14 @@ void Timer::Notify( void )
             }
         }
     }
-    else if( p_intf->p_sys->b_playing && !intf_ShouldDie( p_intf ) )
+    else if( p_intf->p_sys->b_playing && vlc_object_alive( p_intf ) )
     {
         p_intf->p_sys->b_playing = 0;
         p_main_interface->TogglePlayButton( PAUSE_S );
         i_old_playing_status = PAUSE_S;
     }
 
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
         vlc_mutex_unlock( &p_intf->change_lock );
 
index f65b090..b8e4a2d 100644 (file)
@@ -96,7 +96,7 @@ void Timer::Notify()
         p_intf->p_sys->b_intf_show = false;
     }
 
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
         vlc_mutex_unlock( &p_intf->change_lock );