]> git.sesse.net Git - vlc/commitdiff
macosx: Save a reference to the view in the voutgl.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 23 Aug 2008 11:33:48 +0000 (13:33 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 23 Aug 2008 13:31:38 +0000 (15:31 +0200)
modules/gui/macosx/vout.m
modules/gui/macosx/voutgl.m

index 9f738b050292fab7b92940e10e004fb433e22ebf..3d309fce246b5f87a85d4fefff8ff837cb45933c 100644 (file)
@@ -145,7 +145,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
 - (id)initWithFrame: (NSRect)frameRect
 {
-    [super initWithFrame: frameRect];
+    self = [super initWithFrame: frameRect];
     p_vout = NULL;
     o_view = nil;
     s_frame = &frameRect;
index 428a557431e85bb1ab6f9446f40364e3c13455e2..6b9ba857f11e13e31de211476d730da801393a90 100644 (file)
@@ -260,7 +260,8 @@ static int Manage( vout_thread_t * p_vout )
         p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
     }
 
-    [p_vout->p_sys->o_vout_view manage];
+    if( p_vout->p_sys->o_vout_view )
+        [p_vout->p_sys->o_vout_view manage];
     return VLC_SUCCESS;
 }
 
@@ -319,8 +320,10 @@ static void Unlock( vout_thread_t * p_vout )
     [p_vout->p_sys->o_glview autorelease];
 
     /* Spawn the window */
-    p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
-                        subView: p_vout->p_sys->o_glview frame: nil];
+    id old_vout = p_vout->p_sys->o_vout_view;
+    p_vout->p_sys->o_vout_view = [[VLCVoutView getVoutView: p_vout
+                        subView: p_vout->p_sys->o_glview frame: nil] retain];
+    [old_vout release];
 }
 
 /* This function will reset the o_vout_view. It's useful to go fullscreen. */
@@ -345,15 +348,18 @@ static void Unlock( vout_thread_t * p_vout )
  
     if( p_vout->p_sys->b_saved_frame )
     {
-        p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
+        id old_vout = p_vout->p_sys->o_vout_view;
+        p_vout->p_sys->o_vout_view = [[VLCVoutView getVoutView: p_vout
                                                       subView: o_glview
-                                                        frame: &p_vout->p_sys->s_frame];
+                                                        frame: &p_vout->p_sys->s_frame] retain];
+        [old_vout release];
     }
     else
     {
-        p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
-                                                      subView: o_glview frame: nil];
+        id old_vout = p_vout->p_sys->o_vout_view;
+        p_vout->p_sys->o_vout_view = [[VLCVoutView getVoutView: p_vout
+                                                      subView: o_glview frame: nil] retain];
+        [old_vout release];
     }
 #undef o_glview
 }