I got the this code in a class:
- (void)cancel {
if (_cancelBlock)
_cancelBlock();
}
- (void)overrideCancelWithBlock:(void(^)(void))cancelBlock {
_cancelBlock = [[cancelBlock copy] retain];
That over-retains the block; just -copy it.
Since Blocks can change form at runtime based upon actions taken and change type at compile time based on implementation details, the various Block classes generally treat retainCount
as the nonsense generator that it is. In some cases, this will mean returning 1 always.
Note that a retainCount
of zero is a logical impossibility in all cases.