From 72b44bd5b6d7be36483cb1404502fecdc9f5f636 Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Sat, 23 Aug 2008 13:33:48 +0200 Subject: [PATCH] macosx: Save a reference to the view in the voutgl. --- 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 9f738b0502..3d309fce24 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 428a557431..6b9ba857f1 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 } -- 2.39.2