CABasicAnimation leaking?
CABasicAnimation leaking?
- Subject: CABasicAnimation leaking?
- From: Mike Manzano <email@hidden>
- Date: Thu, 28 May 2009 16:31:46 -0700
Hi all,
I have some animation code that looks like this:
CABasicAnimation *theAnimation = [CABasicAnimation
animationWithKeyPath:@"position.x"] ;
NSLog( @"ANIMATION: started %x" , theAnimation ) ;
theAnimation.removedOnCompletion = YES ;
theAnimation.duration = 0.125f ;
theAnimation.repeatCount = 1 ;
theAnimation.autoreverses = NO ;
theAnimation.fromValue = [NSNumber
numberWithFloat:self.currentlySlidingCell.layer.position.x] ;
theAnimation.toValue = [NSNumber
numberWithFloat:self.currentlySlidingCell.layer.position.x -
self.currentlySlidingCell.frame.origin.x] ;
theAnimation.delegate = self ;
self.superview.userInteractionEnabled = NO ;
[self.currentlySlidingCell.layer addAnimation:theAnimation
forKey:@"slideResetAnimation"] ;
When I run the program (in the iPhone simulator) with Instruments
running, I get several CABasicAnimation leaks of 16 bytes. How could I
possibly getting this leak if addAnimation:forKey: always replaces the
previous animation for the key? I would expect any animation that is
replaced for that key would be released by the layer.
There is a possibility in my code for the animation to be removed
before it finishes. This method is called from willRemoveSubview of my
animating layer's superlayer. it may occur while animating:
- (void) cleanupSliding
{
NSLog( @"ANIMATION cleaning up sliding" ) ;
NSAssert( self.currentlySlidingCell != nil , @"_currentlySlidingCell
is nil" ) ;
[self.currentlySlidingCell.layer
removeAnimationForKey:@"slideResetAnimation"] ;
…
Could this somehow cause the animation to not get released?
Regardless of whether I remove the animation or not, simply replacing
it by setting a new animation with the same key should suffice to
release the previous animation, right?
Thanks,
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden