vlc/vlc-2.0 | branch: master | Felix Paul Kühne <[email protected]> | Wed Jul 18 01:00:04 2012 +0200| [64a2b485c1d7ee676074b6afd2baf4145c186968] | committer: Felix Paul Kühne
macosx: vlc object handling improvements (refs #6883) should solve a few problems on termination > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=64a2b485c1d7ee676074b6afd2baf4145c186968 --- modules/gui/macosx/MainMenu.m | 13 +++++-------- modules/gui/macosx/VideoView.m | 6 ++++-- modules/gui/macosx/bookmarks.m | 11 ++++++++++- modules/gui/macosx/controls.m | 14 +++++--------- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m index 4f4456a..bc0b93f 100644 --- a/modules/gui/macosx/MainMenu.m +++ b/modules/gui/macosx/MainMenu.m @@ -441,15 +441,13 @@ static VLCMainMenu *_o_sharedInstance = nil; [self setupVarMenuItem: o_mi_visual target: (vlc_object_t *)p_aout var: "visual" selector: @selector(toggleVar:)]; - vlc_object_release( (vlc_object_t *)p_aout ); + vlc_object_release( p_aout ); } vout_thread_t * p_vout = input_GetVout( p_input ); if( p_vout != NULL ) { - vlc_object_t * p_dec_obj; - [self setupVarMenuItem: o_mi_aspect_ratio target: (vlc_object_t *)p_vout var: "aspect-ratio" selector: @selector(toggleVar:)]; @@ -467,7 +465,7 @@ static VLCMainMenu *_o_sharedInstance = nil; (vlc_object_t *)p_vout var:"postprocess" selector: @selector(toggleVar:)]; #endif - vlc_object_release( (vlc_object_t *)p_vout ); + vlc_object_release( p_vout ); [self refreshVoutDeviceMenu:nil]; [self setSubmenusEnabled: YES]; @@ -1233,13 +1231,11 @@ static VLCMainMenu *_o_sharedInstance = nil; if( p_vout != NULL ) { if( [o_title isEqualToString: _NS("Float on Top")] ) - { [o_mi setState: var_GetBool( p_vout, "video-on-top" )]; - } bEnabled = TRUE; - vlc_object_release( (vlc_object_t *)p_vout ); + vlc_object_release( p_vout ); } } if( [o_title isEqualToString: _NS("Fullscreen")] ) @@ -1301,7 +1297,8 @@ bool b_telx = p_input && var_GetInteger( p_input, "teletext-es" ) >= 0; - (void)dealloc { - vlc_object_release( _vlc_object ); + if( _vlc_object ) + vlc_object_release( _vlc_object ); if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( value.psz_string ); free( psz_name ); diff --git a/modules/gui/macosx/VideoView.m b/modules/gui/macosx/VideoView.m index b191bc7..55d5204 100644 --- a/modules/gui/macosx/VideoView.m +++ b/modules/gui/macosx/VideoView.m @@ -109,7 +109,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, - (void)closeVout { vout_thread_t * p_vout = getVout(); - if( !p_vout ) + if( p_vout ) { var_DelCallback( p_vout, "video-device", DeviceCallback, NULL ); vlc_object_release( p_vout ); @@ -166,10 +166,12 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, val.i_int |= (int)CocoaKeyToVLC( key ); var_Set( p_vout->p_libvlc, "key-pressed", val ); } - vlc_object_release( p_vout ); } else msg_Dbg( VLCIntf, "could not send keyevent to VLC core" ); + + if (p_vout) + vlc_object_release( p_vout ); } else [super keyDown: o_event]; diff --git a/modules/gui/macosx/bookmarks.m b/modules/gui/macosx/bookmarks.m index f0ad4fc..2cc0e44 100644 --- a/modules/gui/macosx/bookmarks.m +++ b/modules/gui/macosx/bookmarks.m @@ -73,6 +73,9 @@ static VLCBookmarks *_o_sharedInstance = nil; - (void)dealloc { + if (p_old_input) + vlc_object_release( p_old_input ); + [super dealloc]; } @@ -155,9 +158,15 @@ static VLCBookmarks *_o_sharedInstance = nil; int row; row = [o_tbl_dataTable selectedRow]; - if( !p_input && row < 0 ) + if( !p_input ) return; + if (row < 0) + { + vlc_object_release( p_input ); + return; + } + if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks, &i_bookmarks ) != VLC_SUCCESS ) { diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m index ba6d9a0..871526a 100644 --- a/modules/gui/macosx/controls.m +++ b/modules/gui/macosx/controls.m @@ -163,7 +163,7 @@ if( p_vout != NULL ) { var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_POSITION ); - vlc_object_release( (vlc_object_t *)p_vout ); + vlc_object_release( p_vout ); } vlc_object_release( p_input ); } @@ -359,14 +359,10 @@ /* Escape */ if( key == (unichar) 0x1b ) { - vout_thread_t *p_vout = getVout(); - if (p_vout) + if (var_GetBool( p_vout, "fullscreen" )) { - if (var_GetBool( p_vout, "fullscreen" )) - { - [[VLCCoreInteraction sharedInstance] toggleFullscreen]; - eventHandled = YES; - } + [[VLCCoreInteraction sharedInstance] toggleFullscreen]; + eventHandled = YES; } } else if( key == ' ' ) @@ -374,7 +370,7 @@ [self play:self]; eventHandled = YES; } - vlc_object_release( (vlc_object_t *)p_vout ); + vlc_object_release( p_vout ); } vlc_object_release( p_input ); } _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
