Re: ARC dealloc best pratice
Re: ARC dealloc best pratice
- Subject: Re: ARC dealloc best pratice
- From: Greg Parker <email@hidden>
- Date: Fri, 06 Feb 2015 13:31:31 -0800
> On Feb 6, 2015, at 12:46 PM, Jens Alfke <email@hidden> wrote:
>
>> On Feb 6, 2015, at 11:55 AM, Jonathan Mitchell <email@hidden> wrote:
>>
>> The tableView.delegate is not a zeroing weak ref - in the lingo of ARC it is unsafe_unretained I believe
>> self can be deallocated leaving tableView.delegate as a dangling pointer.
>
> This is still a weak reference, it's just unsafe (non-zeroing.) You're right that these need to be cleaned up manually.
We prefer to reserve the term "weak" for safe zeroing weak.
> Come to think of it, I'm surprised that AppKit delegates are still unsafe-unretained. Why haven't these been converted to safe weak references yet?
Some classes are incompatible with (safe zeroing) weak references. For example, any class that implements custom retain count storage needs additional code to work with weak references. That means AppKit needs to be careful about binary compatibility when it changes an unretained delegate to a weak delegate.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden