Commit 1c6e5232 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

macosx vout: another memleak

A memleak in the handling of NSAnimation
(cherry picked from commit 9d7513ae)
Signed-off-by: default avatarDerk-Jan Hartman <hartman@videolan.org>
parent 731a20c1
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
[o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable]; [o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
o_fullscreen_window = nil; o_fullscreen_window = nil;
o_fullscreen_anim1 = o_fullscreen_anim2 = nil; o_makekey_anim = o_fullscreen_anim1 = o_fullscreen_anim2 = nil;
/* Not fullscreen when we wake up */ /* Not fullscreen when we wake up */
[o_btn_fullscreen setState: NO]; [o_btn_fullscreen setState: NO];
...@@ -356,8 +356,8 @@ ...@@ -356,8 +356,8 @@
- Keep at most 2 animation at a time - Keep at most 2 animation at a time
- leaveFullscreen/enterFullscreen are the only responsible for releasing and alloc-ing - leaveFullscreen/enterFullscreen are the only responsible for releasing and alloc-ing
*/ */
o_fullscreen_anim1 = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict1, nil]]; o_fullscreen_anim1 = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dict1]];
o_fullscreen_anim2 = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict2, nil]]; o_fullscreen_anim2 = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dict2]];
[dict1 release]; [dict1 release];
[dict2 release]; [dict2 release];
...@@ -525,7 +525,11 @@ ...@@ -525,7 +525,11 @@
- (void)animationDidEnd:(NSAnimation*)animation - (void)animationDidEnd:(NSAnimation*)animation
{ {
NSArray *viewAnimations; NSArray *viewAnimations;
if( o_makekey_anim == animation )
{
[o_makekey_anim release];
return;
}
if ([animation currentValue] < 1.0) if ([animation currentValue] < 1.0)
return; return;
...@@ -569,17 +573,19 @@ ...@@ -569,17 +573,19 @@
[super setAlphaValue:0.0f]; [super setAlphaValue:0.0f];
[super makeKeyAndOrderFront: sender]; [super makeKeyAndOrderFront: sender];
NSMutableDictionary * dict = [[[NSMutableDictionary alloc] initWithCapacity:2] autorelease]; NSMutableDictionary * dict = [[NSMutableDictionary alloc] initWithCapacity:2];
[dict setObject:self forKey:NSViewAnimationTargetKey]; [dict setObject:self forKey:NSViewAnimationTargetKey];
[dict setObject:NSViewAnimationFadeInEffect forKey:NSViewAnimationEffectKey]; [dict setObject:NSViewAnimationFadeInEffect forKey:NSViewAnimationEffectKey];
NSViewAnimation * anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dict]]; o_makekey_anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dict]];
[dict release];
[anim setAnimationBlockingMode: NSAnimationNonblocking]; [o_makekey_anim setAnimationBlockingMode: NSAnimationNonblocking];
[anim setDuration: 0.1]; [o_makekey_anim setDuration: 0.1];
[anim setFrameRate: 30]; [o_makekey_anim setFrameRate: 30];
[o_makekey_anim setDelegate: self];
[anim startAnimation]; [o_makekey_anim startAnimation];
b_window_is_invisible = NO; b_window_is_invisible = NO;
/* fullscreenAnimation will be unlocked when animation ends */ /* fullscreenAnimation will be unlocked when animation ends */
...@@ -616,7 +622,8 @@ ...@@ -616,7 +622,8 @@
[NSValue valueWithRect:[self frame]], NSViewAnimationStartFrameKey, [NSValue valueWithRect:[self frame]], NSViewAnimationStartFrameKey,
[NSValue valueWithRect:args->frame], NSViewAnimationEndFrameKey, nil]; [NSValue valueWithRect:args->frame], NSViewAnimationEndFrameKey, nil];
NSViewAnimation * anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]]; NSViewAnimation * anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dict]];
[dict release];
[anim setAnimationBlockingMode: NSAnimationNonblocking]; [anim setAnimationBlockingMode: NSAnimationNonblocking];
[anim setDuration: 0.4]; [anim setDuration: 0.4];
......
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