Commit 1aeb56fa authored by hartman's avatar hartman
Browse files

macosx: vlc object leaking:

NSMenuItems still exist when libvlc_Quit is called, and thus some items are likely not autoreleased before vlc quits. Set all representedObjects for all menu's to null so that the menuitems no longer retain any of the vlc objects.
parent e2fd56a1
......@@ -700,6 +700,19 @@ static VLCMain *_o_sharedMainInstance = nil;
#pragma mark -
#pragma mark Termination
- (void)releaseRepresentedObjects:(NSMenu *)the_menu
{
NSArray *menuitems_array = [the_menu itemArray];
for( int i=0; i<[menuitems_array count]; i++ )
{
NSMenuItem *one_item = [menuitems_array objectAtIndex: i];
if( [one_item hasSubmenu] )
[self releaseRepresentedObjects: [one_item submenu]];
[one_item setRepresentedObject:NULL];
}
}
- (void)applicationWillTerminate:(NSNotification *)notification
{
playlist_t * p_playlist;
......@@ -794,6 +807,9 @@ static VLCMain *_o_sharedMainInstance = nil;
/* write cached user defaults to disk */
[[NSUserDefaults standardUserDefaults] synchronize];
/* Make sure the Menu doesn't have any references to vlc objects anymore */
[self releaseRepresentedObjects:[NSApp mainMenu]];
/* Kill the playlist, so that it doesn't accept new request
* such as the play request from vlc.c (we are a blocking interface). */
p_playlist = pl_Hold( p_intf );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment