Browse files

Futures free their handlers as soon as they’re completed/cancelled.

  • Loading branch information...
1 parent 59e8ea1 commit b05578af2f62b71ef1df7136a199ccaea9d3e0c8 @robrix committed Mar 22, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 RXFutures/RXFuture.m
View
12 RXFutures/RXFuture.m
@@ -66,6 +66,12 @@ -(void)cancel {
for(void (^block)() in cancellationHandlers) {
[self dispatchCallback:block];
}
+#if !__has_feature(objc_arc)
+ [completionHandlers release];
+ [cancellationHandlers release];
+#endif
+ completionHandlers = nil;
+ cancellationHandlers = nil;
}
}];
}
@@ -93,6 +99,12 @@ -(void)complete {
for(void (^block)() in completionHandlers) {
[self dispatchCallback:block];
}
+#if !__has_feature(objc_arc)
+ [completionHandlers release];
+ [cancellationHandlers release];
+#endif
+ completionHandlers = nil;
+ cancellationHandlers = nil;
}
}];
}

0 comments on commit b05578a

Please sign in to comment.