]> git.sesse.net Git - vlc/commitdiff
* - This should fix the "crash upon quit" issue with VLC Mac OS X.
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 15 Dec 2005 01:44:00 +0000 (01:44 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 15 Dec 2005 01:44:00 +0000 (01:44 +0000)
  - It should also no longer crash if you select macosx as an extraintf. This is not allowed. It is the cause of the NSDictionary crash reported often in the forums. Notice however that if you have selected a primary interface that is not macosx, you might end up with a "blank application" forcing you to reset the preferences manually (your fault for mocking with them in the first place).
  - Should fix clivlc mode. (this mode allows you to run VLC on OSX while no user is logged in, in the GUI).

Thanks to Jean-Michel Vallat for kicking my ass. :D

modules/gui/macosx/intf.m
src/interface/interface.c

index 649e5cf1a2dd9806e192777b5849e7b8d961805c..1c67bcac7d8a6adbf34015132a06c5fa815cc2fa 100644 (file)
@@ -806,7 +806,6 @@ static VLCMain *_o_sharedMainInstance = nil;
 
 - (void)manage
 {
-    NSDate * o_sleep_date;
     playlist_t * p_playlist;
 
     /* new thread requires a new pool */
@@ -861,12 +860,8 @@ static VLCMain *_o_sharedMainInstance = nil;
         [self manageVolumeSlider];
 
         vlc_mutex_unlock( &p_intf->change_lock );
-
-        o_sleep_date = [NSDate dateWithTimeIntervalSinceNow: .1];
-        [NSThread sleepUntilDate: o_sleep_date];
+        msleep( 100000 );
     }
-
-    [self terminate];
     [o_pool release];
 }
 
@@ -1434,7 +1429,6 @@ static VLCMain *_o_sharedMainInstance = nil;
     [[NSUserDefaults standardUserDefaults] synchronize];
 
     p_intf->b_die = VLC_TRUE;
-    [NSApp stop:NULL];
 }
 
 - (IBAction)clearRecentItems:(id)sender
index 36a57eb795a4d780511c71fb97ef22a5406b283b..b40a2c4a624a0a7ca3045f3eea7f0a009c886020 100644 (file)
@@ -66,8 +66,11 @@ static int AddIntfCallback( vlc_object_t *, char const *,
  *****************************************************************************/
 @interface VLCApplication : NSApplication
 {
+   vlc_t *o_vlc;
 }
 
+- (void)setVLC: (vlc_t *)p_vlc;
+
 @end
 #endif
 
@@ -157,11 +160,12 @@ int intf_RunThread( intf_thread_t *p_intf )
         }
     }
 
-    if( p_intf->b_block && strncmp( p_intf->p_module->psz_object_name,
+    if( p_intf->b_block && strncmp( p_intf->p_vlc->psz_object_name,
                                     "clivlc", 6) )
     {
         o_pool = [[NSAutoreleasePool alloc] init];
         [VLCApplication sharedApplication];
+        [NSApp setVLC: p_intf->p_vlc];
     }
 
     if( p_intf->b_block &&
@@ -175,6 +179,11 @@ int intf_RunThread( intf_thread_t *p_intf )
     else
     {
         /* Run the interface in a separate thread */
+        if( !strcmp( p_intf->p_module->psz_object_name, "macosx" ) )
+        {
+            msg_Err( p_intf, "You cannot run the MacOS X module as an extrainterface. Please read the README.MacOSX.rtf file");
+            return VLC_EGENERIC;
+        }
         if( vlc_thread_create( p_intf, "interface", RunInterface,
                                VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) )
         {
@@ -446,6 +455,11 @@ static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
  *****************************************************************************/
 @implementation VLCApplication 
 
+- (void)setVLC: (vlc_t *) p_vlc
+{
+    o_vlc = p_vlc;
+}
+
 - (void)stop: (id)sender
 {
     NSEvent *o_event;
@@ -465,9 +479,7 @@ static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
 
 - (void)terminate: (id)sender
 {
-    if( [NSApp isRunning] )
-        [NSApp stop:sender];
-    [super terminate: sender];
+    o_vlc->b_die = VLC_TRUE;
 }
 
 @end