Commit 36aca393 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove intf_ShouldDie

libvlc kills the interfaces when it dies anyway.
parent 872779fb
...@@ -108,10 +108,6 @@ VLC_EXPORT( intf_thread_t *, __intf_Create, ( vlc_object_t *, const char * ) ...@@ -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( int, intf_RunThread, ( intf_thread_t * ) );
VLC_EXPORT( void, intf_StopThread, ( 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) #define intf_Eject(a,b) __intf_Eject(VLC_OBJECT(a),b)
VLC_EXPORT( int, __intf_Eject, ( vlc_object_t *, const char * ) ); VLC_EXPORT( int, __intf_Eject, ( vlc_object_t *, const char * ) );
......
...@@ -182,7 +182,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -182,7 +182,7 @@ static void RunIntf( intf_thread_t *p_intf )
msg_Dbg( p_intf, "interface thread initialized" ); msg_Dbg( p_intf, "interface thread initialized" );
/* Main loop */ /* Main loop */
while( !intf_ShouldDie( p_intf ) ) while( vlc_object_alive( p_intf ) )
{ {
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
...@@ -461,7 +461,7 @@ static int InitThread( intf_thread_t * p_intf ) ...@@ -461,7 +461,7 @@ static int InitThread( intf_thread_t * p_intf )
{ {
char *psz_button; char *psz_button;
/* we might need some locking here */ /* we might need some locking here */
if( !intf_ShouldDie( p_intf ) ) if( vlc_object_alive( p_intf ) )
{ {
/* p_intf->change_lock locking strategy: /* p_intf->change_lock locking strategy:
* - Every access to p_intf->p_sys are locked threw p_intf->change_lock * - Every access to p_intf->p_sys are locked threw p_intf->change_lock
......
...@@ -175,7 +175,7 @@ static int Process( intf_thread_t *p_intf ) ...@@ -175,7 +175,7 @@ static int Process( intf_thread_t *p_intf )
if( code == NULL ) if( code == NULL )
return 0; return 0;
while( !intf_ShouldDie( p_intf ) while( vlc_object_alive( p_intf )
&& (lirc_code2char( p_intf->p_sys->config, code, &c ) == 0) && (lirc_code2char( p_intf->p_sys->config, code, &c ) == 0)
&& (c != NULL) ) && (c != NULL) )
{ {
......
...@@ -150,7 +150,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -150,7 +150,7 @@ static void Run( intf_thread_t *p_intf )
/* High priority thread */ /* High priority thread */
vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_INPUT ); vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_INPUT );
while( !intf_ShouldDie( p_intf ) ) while( vlc_object_alive( p_intf ) )
{ {
/* Update the input */ /* Update the input */
if( p_input == NULL ) if( p_input == NULL )
......
...@@ -479,7 +479,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -479,7 +479,7 @@ static void Run( intf_thread_t *p_intf )
} }
#endif #endif
while( !intf_ShouldDie( p_intf ) ) while( vlc_object_alive( p_intf ) )
{ {
char *psz_cmd, *psz_arg; char *psz_cmd, *psz_arg;
bool b_complete; bool b_complete;
...@@ -2050,7 +2050,7 @@ bool ReadWin32( intf_thread_t *p_intf, char *p_buffer, int *pi_size ) ...@@ -2050,7 +2050,7 @@ bool ReadWin32( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
while( WaitForSingleObject( p_intf->p_sys->hConsoleIn, while( WaitForSingleObject( p_intf->p_sys->hConsoleIn,
INTF_IDLE_SLEEP/1000 ) == WAIT_OBJECT_0 ) 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, ReadConsoleInput( p_intf->p_sys->hConsoleIn, &input_record,
1, &i_dw ) ) 1, &i_dw ) )
{ {
...@@ -2120,7 +2120,7 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size ) ...@@ -2120,7 +2120,7 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
} }
#endif #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 ? (i_read = net_Read( p_intf, p_intf->p_sys->i_socket == -1 ?
0 /*STDIN_FILENO*/ : p_intf->p_sys->i_socket, NULL, 0 /*STDIN_FILENO*/ : p_intf->p_sys->i_socket, NULL,
(uint8_t *)p_buffer + *pi_size, 1, false ) ) > 0 ) (uint8_t *)p_buffer + *pi_size, 1, false ) ) > 0 )
......
...@@ -121,7 +121,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -121,7 +121,7 @@ static void RunIntf( intf_thread_t *p_intf )
} }
/* Main loop */ /* Main loop */
while( !intf_ShouldDie( p_intf ) ) while( vlc_object_alive( p_intf ) )
{ {
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
...@@ -179,7 +179,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -179,7 +179,7 @@ static void RunIntf( intf_thread_t *p_intf )
*****************************************************************************/ *****************************************************************************/
static int InitThread( 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 ); vlc_mutex_lock( &p_intf->change_lock );
......
...@@ -120,7 +120,7 @@ void CloseIntf ( vlc_object_t *p_this ) ...@@ -120,7 +120,7 @@ void CloseIntf ( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static void Run( intf_thread_t *p_intf ) 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(); p_intf->p_sys->p_window->UpdateInterface();
msleep( INTF_IDLE_SLEEP ); msleep( INTF_IDLE_SLEEP );
......
...@@ -1272,7 +1272,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -1272,7 +1272,7 @@ static void Run( intf_thread_t *p_intf )
intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys; intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys;
int canc = vlc_savecancel(); int canc = vlc_savecancel();
while( !intf_ShouldDie( p_intf ) ) while( vlc_object_alive( p_intf ) )
{ {
int i; int i;
......
...@@ -404,7 +404,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -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-append", PlaylistChanged, p_intf );
var_AddCallback( p_playlist, "item-change", 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 ); msleep( INTF_IDLE_SLEEP );
......
...@@ -317,7 +317,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -317,7 +317,7 @@ static void Run( intf_thread_t *p_intf )
#ifdef NEED_GTK2_MAIN #ifdef NEED_GTK2_MAIN
msg_Dbg( p_intf, "Manage GTK keyboard events using threads" ); msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
while( !intf_ShouldDie( p_intf ) ) while( vlc_object_alive( p_intf ) )
{ {
Manage( p_intf ); Manage( p_intf );
...@@ -516,14 +516,14 @@ static int Manage( intf_thread_t *p_intf ) ...@@ -516,14 +516,14 @@ static int Manage( intf_thread_t *p_intf )
} }
vlc_object_unlock( p_input ); 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 ); GtkModeManage( p_intf );
p_intf->p_sys->b_playing = 0; p_intf->p_sys->b_playing = 0;
} }
#ifndef NEED_GTK2_MAIN #ifndef NEED_GTK2_MAIN
if( intf_ShouldDie( p_intf ) ) if( !vlc_object_alive( p_intf ) )
{ {
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
......
...@@ -924,7 +924,7 @@ void MainInterface::setRate( int rate ) ...@@ -924,7 +924,7 @@ void MainInterface::setRate( int rate )
void MainInterface::updateOnTimer() void MainInterface::updateOnTimer()
{ {
/* No event for dying */ /* No event for dying */
if( intf_ShouldDie( p_intf ) ) if( !vlc_object_alive( p_intf ) )
{ {
QApplication::closeAllWindows(); QApplication::closeAllWindows();
QApplication::quit(); QApplication::quit();
......
...@@ -210,14 +210,14 @@ void Timer::Notify( void ) ...@@ -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_intf->p_sys->b_playing = 0;
p_main_interface->TogglePlayButton( PAUSE_S ); p_main_interface->TogglePlayButton( PAUSE_S );
i_old_playing_status = 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 ); vlc_mutex_unlock( &p_intf->change_lock );
......
...@@ -96,7 +96,7 @@ void Timer::Notify() ...@@ -96,7 +96,7 @@ void Timer::Notify()
p_intf->p_sys->b_intf_show = false; 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 ); vlc_mutex_unlock( &p_intf->change_lock );
......
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