Skip to content

Commit

Permalink
Addressing memory leak in TPHostAnimationController where TPEffectsWi…
Browse files Browse the repository at this point in the history
…ndows were being created and added to an NSSet and never removed/released johndbritton#10
  • Loading branch information
atljeremy committed Apr 10, 2015
1 parent 464df66 commit 8a78d76
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions TPHostAnimationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ - (void)showFireAnimationForHost:(TPRemoteHost*)host atPoint:(NSPoint)point onSc
CGRect imageBounds = CGRectMake(0.0, 0.0, CGImageGetWidth(_haloImageRef), CGImageGetHeight(_haloImageRef));
id layers[FIRE_HALO_COUNT];

id layerClass = NSClassFromString(@"CALayer");
id transactionClass = NSClassFromString(@"CATransaction");
id layerClass = [CALayer class];
id transactionClass = [CATransaction class];

float xDirection = 0.0;
float yDirection = 0.0;
Expand Down Expand Up @@ -214,7 +214,7 @@ - (void)showFireAnimationForHost:(TPRemoteHost*)host atPoint:(NSPoint)point onSc
[effectWindow orderFront:nil];

[transactionClass begin];
[transactionClass setValue:[NSNumber numberWithFloat:FIRE_DURATION] forKey:@"animationDuration"];
[transactionClass setValue:@(FIRE_DURATION) forKey:@"animationDuration"];

for(i=0; i<FIRE_HALO_COUNT; i++) {
id layer = layers[i];
Expand All @@ -236,6 +236,9 @@ - (void)showFireAnimationForHost:(TPRemoteHost*)host atPoint:(NSPoint)point onSc
- (void)_doneFireAnimation:(NSWindow*)effectWindow
{
[effectWindow close];

// This addresses https://github.com/abyssoft/teleport/issues/10
[_effectWindows removeObject:effectWindow];
}


Expand Down

0 comments on commit 8a78d76

Please sign in to comment.