Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f54f2aa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still necessary do you think with ARC enabled?
f54f2aa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think copying the block is still required to move the objects captured by the block out of the stack and onto the heap. Naturally, the release of the copied block would be subsequently done by ARC.
Whether the resultant code could be simplified back to the original version or not... I think that it probably could. ARC should "do the right thing" here WRT the copied block.
f54f2aa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that blocks are objects (http://thirdcog.eu/pwcblocks/#objcblocks) and therefore the only thing that's on the stack is the pointer to the object itself, thus there's no more need to copy it than there is any other Objective-C object. Either way it doesn't hurt to copy it... Thanks for the code by the way :)
f54f2aa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Very useful.