Comment Re: a simple change, but a new race condition (Score 1) 342
Garbage collection is robust enoughâ" the block gets copied to the (garbage collected) heap when it's passed into dispatch_async() or similar calls automatically, and it uses scanned memory to do so, meaning the collector tracks a refcount on 'self'.
In non-collected situations, it's up to the developer to ensure that this doesn't happen somehowâ" for instance by retaining 'self' before the first dispatch_async() and releasing it inside the last block.