On May 7, 2014, at 15:08 , Mills, Steve <smi...@makemusic.com> wrote:

> Is this all safe and legal, releasing self right before it returns to 
> whatever called it?

I believe it’s safe in manual RR, though you could perhaps do ‘[self 
autorelease]’ if you feel uncertain. I’m not sure it’d be safe under ARC (that 
is, doing something that could cause ‘self’ to be deallocated), because ARC 
might have epilogue code at the end of the scope, and that *might* refer to 
self.

However, it’s probably safe for a different reason. ‘performSelector’ should 
retain its receiver, and presumably won’t release it until after the performed 
method returns, so your ‘[self release]’ presumably won’t actually result in 
deallocation.

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to