[vlc-devel] commit: minimal_macosx: Make sure we actually kill the vout at some point. (Pierre d'Herbemont )

git version control git at videolan.org
Wed Aug 26 23:26:05 CEST 2009


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Wed Aug 26 23:24:45 2009 +0200| [0c30240f3377fecead85ed25ce6bfa4275b2518b] | committer: Pierre d'Herbemont 

minimal_macosx: Make sure we actually kill the vout at some point.

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

 modules/gui/minimal_macosx/VLCOpenGLVoutView.m |   19 +++++++++++--------
 modules/gui/minimal_macosx/voutgl.m            |    1 +
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/modules/gui/minimal_macosx/VLCOpenGLVoutView.m b/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
index bb3b1c5..38ee22f 100644
--- a/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
+++ b/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
@@ -80,6 +80,9 @@ void cocoaglvoutviewEnd( vout_thread_t * p_vout )
 {
     id <VLCOpenGLVoutEmbedding> o_cocoaglview_container;
 
+    if (!p_vout->p_sys->o_glview)
+        return;
+
     msg_Dbg( p_vout, "Mac OS X Vout is closing" );
     var_Destroy( p_vout, "drawable-nsobject" );
 
@@ -89,15 +92,15 @@ void cocoaglvoutviewEnd( vout_thread_t * p_vout )
     [p_vout->p_sys->o_glview detachFromVout];
     msg_Dbg( p_vout, "Mac OS X Vout is closing" );
 
-    /* Let the view go, _without_blocking_ */
-    [p_vout->p_sys->o_glview performSelectorOnMainThread:@selector(removeFromSuperview) withObject:NULL waitUntilDone:NO];
-
     if( [(id)o_cocoaglview_container respondsToSelector:@selector(removeVoutSubview:)] )
-        [o_cocoaglview_container removeVoutSubview: p_vout->p_sys->o_glview];
+        [o_cocoaglview_container performSelectorOnMainThread:@selector(removeVoutSubview:) withObject:p_vout->p_sys->o_glview waitUntilDone:NO];
 
-    [p_vout->p_sys->o_glview release];
+    /* Let the view go and release it, _without_blocking_ */
+    [p_vout->p_sys->o_glview performSelectorOnMainThread:@selector(removeFromSuperviewAndRelease) withObject:nil waitUntilDone:NO];
+    p_vout->p_sys->o_glview = nil;
 
     [p_vout->p_sys->o_pool release];
+    p_vout->p_sys->o_pool = nil;
  
 }
 
@@ -219,12 +222,12 @@ void cocoaglvoutviewUnlock( vout_thread_t * p_vout )
     [super dealloc];
 }
 
-- (void)removeFromSuperview
+- (void)removeFromSuperviewAndRelease
 {
-    [super removeFromSuperview];
+    [self removeFromSuperview];
+    [self release];
 }
 
-
 - (id) initWithVout: (vout_thread_t *) vout container: (id <VLCOpenGLVoutEmbedding>) aContainer
 {
     NSOpenGLPixelFormatAttribute attribs[] =
diff --git a/modules/gui/minimal_macosx/voutgl.m b/modules/gui/minimal_macosx/voutgl.m
index 2fd0f41..6daabe3 100644
--- a/modules/gui/minimal_macosx/voutgl.m
+++ b/modules/gui/minimal_macosx/voutgl.m
@@ -98,6 +98,7 @@ int OpenVideoGL  ( vlc_object_t * p_this )
 void CloseVideoGL ( vlc_object_t * p_this )
 {
     vout_thread_t * p_vout = (vout_thread_t *) p_this;
+    cocoaglvoutviewEnd( p_vout );
     /* Clean up */
     free( p_vout->p_sys );
 }




More information about the vlc-devel mailing list