• 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: NSTableView is messaging zombie delegate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView is messaging zombie delegate


  • Subject: Re: NSTableView is messaging zombie delegate
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 06 May 2016 13:28:10 -0700

> On May 6, 2016, at 1:03 PM, Matthew LeRoy <email@hidden> wrote:
>
> My understanding is that NSTableView's delegate is a zeroing weak reference

Are you sure? Historically it’s been unsafe_unretained — in the old days before weak references or ARC, the view never retained nor released the delegate. The type of crash you’re having was a not-uncommon bug.

Apple may have upgraded the property to a proper zeroing weak reference, but I can’t tell from the docs. They simply say "In a managed memory environment, the table view maintains a weak reference to the delegate (that is, it does not retain the delegate).” I’m assuming ARC counts as “managed”, but that sentence does not include the word “zeroing”…

I would play it safe and explicitly set the table view’s delegate to nil when tearing down the window. I usually do this in the windowWillClose delegate method.

—Jens
_______________________________________________

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: NSTableView is messaging zombie delegate
      • From: Sean McBride <email@hidden>
    • Re: NSTableView is messaging zombie delegate
      • From: Matthew LeRoy <email@hidden>
References: 
 >NSTableView is messaging zombie delegate (From: Matthew LeRoy <email@hidden>)

  • Prev by Date: Re: NSTableView is messaging zombie delegate
  • Next by Date: Receiver type for instance message is a forward declaration
  • Previous by thread: Re: NSTableView is messaging zombie delegate
  • Next by thread: Re: NSTableView is messaging zombie delegate
  • Index(es):
    • Date
    • Thread