]> git.sesse.net Git - vlc/commitdiff
macosx/vout*: quick kludge for Tiger crashes
authorEric Petit <titer@videolan.org>
Thu, 19 May 2005 14:11:30 +0000 (14:11 +0000)
committerEric Petit <titer@videolan.org>
Thu, 19 May 2005 14:11:30 +0000 (14:11 +0000)
  Use performSelectorOnMainThread when available (>= 10.2) to create
  the window from the main thread. Also fixed a couple warnings

modules/gui/macosx/vout.h
modules/gui/macosx/vout.m

index b475efbaa6534937e5fc0173eebb7095c9921189..e2babf1bf6cc2caa145587ab6a5c9b7a219eea47 100644 (file)
 
     Ptr             p_fullscreen_state;
     mtime_t         i_time_mouse_last_moved;
+    NSRect        * s_frame;
+    vlc_bool_t      b_init_ok;
 }
 
-- (id)initWithVout:(vout_thread_t *)_p_vout
-    frame:(NSRect *)s_frame;
+- (id) initWithVout: (vout_thread_t *) p_vout frame: (NSRect *) s_frame;
+- (id) initReal: (id) sender;
 - (void)close;
 - (void)setOnTop:(BOOL)b_on_top;
 
index 33501d1e189eda9c38d3c51b7bd664d6841439e3..9bfc0075f6d095f3e22a797e82c22f1fe660bf0d 100644 (file)
@@ -65,7 +65,30 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
  *****************************************************************************/
 @implementation VLCWindow
 
-- (id)initWithVout:(vout_thread_t *)_p_vout frame:(NSRect *)s_frame
+- (id) initWithVout: (vout_thread_t *) vout frame: (NSRect *) frame
+{
+    p_vout  = vout;
+    s_frame = frame;
+
+    if( MACOS_VERSION >= 10.2 )
+    {
+        [self performSelectorOnMainThread: @selector(initReal:)
+            withObject: NULL waitUntilDone: YES];
+    }
+    else
+    {
+        [self initReal: NULL];
+    }
+
+    if( !b_init_ok )
+    {
+        return NULL;
+    }
+    
+    return self;
+}
+
+- (id) initReal: (id) sender
 {
     NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
     NSArray *o_screens = [NSScreen screens];
@@ -74,7 +97,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     int i_timeout, i_device;
     vlc_value_t value_drawable;
 
-    p_vout = _p_vout;
+    b_init_ok = VLC_FALSE;
 
     var_Get( p_vout->p_vlc, "drawable", &value_drawable );
 
@@ -261,6 +284,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     [self makeFirstResponder: self];
     
     [o_pool release];
+
+    b_init_ok = VLC_TRUE;
     return self;
 }
 
@@ -455,7 +480,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
 - (void)updateTitle
 {
-    NSMutableString * o_title,* o_mrl;
+    NSMutableString * o_title = NULL, * o_mrl = NULL;
     input_thread_t * p_input;
     
     if( p_vout == NULL )