PRTweenOperation retain?
Closed this issue · 2 comments
I'm using PRTweenCGPointLerp helper method and I'm wondering how to release the operation when the animation is finished. Basically, with the following example, _gridB is retained by PRTween somewhere and then it never gets released when I call [_gridB release] later. If I remove the tween, it is released fine. Seems like PRTweenOperation is retaining a reference in there somewhere. Where in the classes do the generated PRTweenOperations get released?
[PRTweenCGPointLerp lerp:_gridB
property:@"center"
from:_gridB.center
to:CGPointMake(self.gridB.center.x, kGridCollapsedOffset)
duration:0.8
timingFunction:&PRTweenTimingFunctionElasticOut
updateBlock:NULL
completeBlock:^{
}];
Good catch.
This is due to unreleased PRTweenOperations inside the shorthand functions. Check out the implementation of + (PRTweenOperation *)tween:(id)object property:(NSString*)property from:(CGFloat)from to:(CGFloat)to duration
and you'll find:
PRTweenOperation *operation = [PRTweenOperation new];
We need to insert a release at the bottom of these methods. I can push a fix tomorrow evening, or feel free to take care of it yourself if it's pressing.
To be clear, PRTweenOperations are still retained by the timeline instance while an animation is occurring and are released automatically when the animation is finished. They're supposed to deallocate at this point, but that wasn't happening due to the extra retain.