On Fri, Apr 8, 2011 at 5:56 PM, Rick Mann <rm...@latencyzero.com> wrote:
> Hmm. Reading the docs there again, it also says:
>
> "Typically, you shouldn’t need to copy (or retain) a block. You only need to 
> make a copy when you expect the block to be used after destruction of the 
> scope within which it was declared. Copying moves a block to the heap."
>
> So, I expressly copied my block and stored the copy in the dictionary. That 
> worked (I mistakenly conflated the fact that keys typically get copied, not 
> objects).

But it references a stack variable, which is going to get destroyed as
soon as the syntactical block enclosing the declaration of your code
block (*sigh* for namespace collision) goes out of scope.

If you reference a stack variable from your block, you cannot allow
that block to escape the scope of that variable.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to