]> git.sesse.net Git - vlc/commitdiff
macosx: replaced dated threading hacks with the latest season stuff
authorFelix Paul Kühne <fkuehne@videolan.org>
Wed, 9 May 2012 18:11:22 +0000 (20:11 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Wed, 9 May 2012 18:12:59 +0000 (20:12 +0200)
Thanks to Rémi for the help

include/vlc_interface.h
modules/gui/macosx/intf.m
src/interface/interface.c

index 14898e38f04b029c883c65adb40e3b31a225a8ad..3a4c0aaf6269a40472c8e0db694fc33332cf54a8 100644 (file)
@@ -54,9 +54,6 @@ typedef struct intf_thread_t
     struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */
     vlc_thread_t thread; /** LibVLC thread */
     /* Thread properties and locks */
-#if defined( __APPLE__ )
-    bool          b_should_run_on_first_thread;
-#endif
 
     /* Specific interfaces */
     intf_sys_t *        p_sys;                          /** system interface */
index 90f7c6cefce20983b54b4a17a19173f019a3c25e..d9b50082f473ff441a2fe9b33a926454bd94de4e 100644 (file)
@@ -65,6 +65,8 @@
 #import <AddressBook/AddressBook.h>         /* for crashlog send mechanism */
 #import <Sparkle/Sparkle.h>                 /* we're the update delegate */
 
+#include "../../../lib/libvlc_internal.h"
+
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
@@ -97,6 +99,7 @@ int OpenIntf ( vlc_object_t *p_this )
 {
     NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
     [VLCApplication sharedApplication];
+
     intf_thread_t *p_intf = (intf_thread_t*) p_this;
 
     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
@@ -107,8 +110,9 @@ int OpenIntf ( vlc_object_t *p_this )
 
     /* subscribe to LibVLCCore's messages */
     vlc_Subscribe( &p_intf->p_sys->sub, MsgCallback, NULL );
-    p_intf->pf_run = Run;
-    p_intf->b_should_run_on_first_thread = true;
+
+    libvlc_SetExitHandler( p_intf->p_libvlc, vlc_object_kill, p_intf );
+    Run( p_intf );
 
     [o_pool release];
     return VLC_SUCCESS;
@@ -205,6 +209,8 @@ static void Run( intf_thread_t *p_intf )
     [[VLCMain sharedInstance] applicationWillTerminate:nil];
     [o_appLock release];
     [o_pool release];
+
+    raise(SIGTERM);
 }
 
 #pragma mark -
index 8161e86cbc0ba6a6c190f85ace70d829b08ac10d..095de2d3316df52b4b4329bb6e834bb7b426c2d4 100644 (file)
@@ -108,9 +108,6 @@ int intf_Create( vlc_object_t *p_this, const char *chain )
     var_AddCallback( p_intf, "intf-add", AddIntfCallback, NULL );
 
     /* Attach interface to LibVLC */
-#if defined( __APPLE__ )
-    p_intf->b_should_run_on_first_thread = false;
-#endif
 
     /* Choose the best module */
     p_intf->p_cfg = NULL;
@@ -130,17 +127,6 @@ int intf_Create( vlc_object_t *p_this, const char *chain )
         goto error;
     }
 
-#if defined( __APPLE__ )
-    /* Hack to get Mac OS X Cocoa runtime running
-     * (it needs access to the main thread) */
-    if( p_intf->b_should_run_on_first_thread )
-    {
-        libvlc_SetExitHandler( p_libvlc, vlc_object_kill, p_intf );
-        assert( p_intf->pf_run );
-        p_intf->pf_run( p_intf );
-        p_intf->pf_run = NULL;
-    }
-#endif
     /* Run the interface in a separate thread */
     if( p_intf->pf_run
      && vlc_clone( &p_intf->thread,