[vlc-devel] commit: macosx: Save a reference to the view in the voutgl. (Pierre d' Herbemont )

git version control git at videolan.org
Sat Aug 23 15:28:35 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Aug 23 13:33:48 2008 +0200| [72b44bd5b6d7be36483cb1404502fecdc9f5f636] | committer: Pierre d'Herbemont 

macosx: Save a reference to the view in the voutgl.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72b44bd5b6d7be36483cb1404502fecdc9f5f636
---

 modules/gui/macosx/vout.m   |    2 +-
 modules/gui/macosx/voutgl.m |   22 ++++++++++++++--------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/modules/gui/macosx/vout.m b/modules/gui/macosx/vout.m
index 9f738b0..3d309fc 100644
--- a/modules/gui/macosx/vout.m
+++ b/modules/gui/macosx/vout.m
@@ -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;
diff --git a/modules/gui/macosx/voutgl.m b/modules/gui/macosx/voutgl.m
index 428a557..6b9ba85 100644
--- a/modules/gui/macosx/voutgl.m
+++ b/modules/gui/macosx/voutgl.m
@@ -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
 }




More information about the vlc-devel mailing list