• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ARC dealloc best pratice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARC dealloc best pratice


  • Subject: Re: ARC dealloc best pratice
  • From: Sean McBride <email@hidden>
  • Date: Tue, 10 Feb 2015 16:20:21 -0500
  • Organization: Rogue Research Inc.

On Fri, 6 Feb 2015 12:46:44 -0800, Jens Alfke said:

>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?

The 'why' has been answered, but worse it's not even clear sometimes what a delegate's situation is.  Take NSTableView.h in the 10.10 SDK:

-------------
/* Get and set the delegate. The delegate can implement methods in the protocol NSTableViewDelegate. All delegate methods are optional. The delegate is a weak reference (non retained) in non garbage collected applications. Under garbage collected apps, it is a strong reference. The default value is 'nil'.
 */
- (void)setDelegate:(id <NSTableViewDelegate>)delegate;
- (id <NSTableViewDelegate>)delegate;
-------------

So based on Greg saying "We prefer to reserve the term 'weak' for safe zeroing weak." I guess for NSTableView there's no need to nil the delegate.  OTOH, my experience converting my GC app to ARC says the exact opposite.  Without clearing the delegate to nil in say windowWillClose, I get sporadic crashes.

What's the true situation for NSTableView?

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



_______________________________________________

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


  • Follow-Ups:
    • Re: ARC dealloc best pratice
      • From: Jonathan Mitchell <email@hidden>
References: 
 >ARC dealloc best pratice (From: Jonathan Mitchell <email@hidden>)
 >Re: ARC dealloc best pratice (From: Jens Alfke <email@hidden>)
 >Re: ARC dealloc best pratice (From: Jonathan Mitchell <email@hidden>)
 >Re: ARC dealloc best pratice (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: NSBezierPath + thin lines + antialias = :(
  • Next by Date: Re: ARC dealloc best pratice
  • Previous by thread: Re: ARC dealloc best pratice
  • Next by thread: Re: ARC dealloc best pratice
  • Index(es):
    • Date
    • Thread