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

modules/gui/macosx.m: Make sure the module will terminate after a Ctrl-C from a term.

parent 260a1836
...@@ -124,6 +124,27 @@ void E_(CloseIntf) ( vlc_object_t *p_this ) ...@@ -124,6 +124,27 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
free( p_intf->p_sys ); free( p_intf->p_sys );
} }
/*****************************************************************************
* KillerThread: Thread that kill the application
*****************************************************************************/
static void * KillerThread( void *user_data )
{
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
intf_thread_t *p_intf = user_data;
vlc_object_lock ( p_intf );
while( vlc_object_alive( p_intf ) )
vlc_object_wait( p_intf );
vlc_object_unlock( p_intf );
msg_Dbg( p_intf, "Killing the Mac OS X module\n" );
/* We are dead, terminate */
[NSApp terminate: nil];
[o_pool release];
return NULL;
}
/***************************************************************************** /*****************************************************************************
* Run: main loop * Run: main loop
*****************************************************************************/ *****************************************************************************/
...@@ -157,6 +178,10 @@ static void Run( intf_thread_t *p_intf ) ...@@ -157,6 +178,10 @@ static void Run( intf_thread_t *p_intf )
[[VLCMain sharedInstance] setIntf: p_intf]; [[VLCMain sharedInstance] setIntf: p_intf];
[NSBundle loadNibNamed: @"MainMenu" owner: NSApp]; [NSBundle loadNibNamed: @"MainMenu" owner: NSApp];
/* Setup a thread that will monitor the module killing */
pthread_t killer_thread;
pthread_create( &killer_thread, NULL, KillerThread, p_intf );
/* Install a jmpbuffer to where we can go back before the NSApp exit /* Install a jmpbuffer to where we can go back before the NSApp exit
* see applicationWillTerminate: */ * see applicationWillTerminate: */
if(setjmp(jmpbuffer) == 0) if(setjmp(jmpbuffer) == 0)
......
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