CPAnimationContext setCompletionHandler: add an equality check

This commit is contained in:
cacaodev committed 2017-06-30 12:00:08 +02:00
1 parent bb2d860807
commit dc87354702
1 file changed
+17 -2
+17 -2
View File
@@ -367,9 +367,24 @@ var _CPAnimationContextStack = nil,
- (void)setCompletionHandler:(Function)aCompletionHandler
{
if (_completionHandlerAgent)
_completionHandlerAgent.invalidate();
{
if (aCompletionHandler === _completionHandlerAgent._completionHandler)
return;
_completionHandlerAgent = aCompletionHandler ? (new CompletionHandlerAgent(aCompletionHandler)) : nil;
_completionHandlerAgent.invalidate();
}
if (aCompletionHandler)
{
_completionHandlerAgent = new CompletionHandlerAgent(aCompletionHandler);
#if (DEBUG)
CPLog.debug("created a new completion Agent with id " + _completionHandlerAgent.id);
#endif
}
else
{
_completionHandlerAgent = nil;
}
}
- (void)completionHandler