> On Feb 6, 2015, at 12:46 PM, Jens Alfke <j...@mooseyard.com> wrote:
> 
> 
>> On Feb 6, 2015, at 11:55 AM, Jonathan Mitchell <jonat...@mugginsoft.com> 
>> 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.
> 
> 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?

Converting an unowned reference to a zeroing-weak reference can cause 
compatibility issues with existing applications that are not prepared for the 
additional semantics required by zeroing-weak references. While this isn’t a 
deal breaker for the future, there still needs to be a compatibility path for 
older applications, and the entire code base needs to be audited to ensure 
correct operation (either by conversion to ARC or ensuring that access goes 
through the proper gating functions).

> 
>> The problem is that there is, I believe, no way to accurately determine 
>> whether a or b is true in any particular instance!
> 
> It depends on the class. For example, NSURLConnection has a well-defined 
> order in which it sends delegate messages, so it's possible to know when it's 
> not going to send any more messages. But yeah, in a window's view hierarchy 
> it's extremely unpredictable so it's important to zero out delegate 
> references.
> 
> —Jens
> _______________________________________________
> 
> 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/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

--
David Duncan


_______________________________________________

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