• 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: dealloc query for NSTableCellView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dealloc query for NSTableCellView


  • Subject: Re: dealloc query for NSTableCellView
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 04 Feb 2015 17:40:40 +0000

On Feb 4, 2015, at 05:43 , Jonathan Mitchell <email@hidden> wrote:
>
>>> Is it normal for superclasses to message during dealloc?
>
> I would still like to know what people’s expectations are here.

It is normal for classes to message during dealloc, so it’s normal for superclasses to do so. However, it’s always been treacherous, for two reasons:

1. In general, using dealloc to release resources can lead to very subtle circular race conditions between objects.

2. In general, you don’t know whether it’s safe to send a message to a partially deallocated object, unless you know the exact details of the implementation, including superclasses.

You’ve come unstuck with case 2. If you were in control of the implementation, you could set _objectValue to nil directly, but you’re not and you can’t. If this were the old days, pre-ARC, you could invoke [super dealloc] first, though you’d have to assume that there were no subclasses being messed up by that.

In a sense, your existing objectValue solution was always wrong, because you never knew for certain whether all changes to the property value went through the setter. The same is true of representedObject, although in that case you might be prepared to bet on your assumptions never failing.



_______________________________________________

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


References: 
 >dealloc query for NSTableCellView (From: Jonathan Mitchell <email@hidden>)
 >Re: dealloc query for NSTableCellView (From: Roland King <email@hidden>)
 >Re: dealloc query for NSTableCellView (From: Jonathan Mitchell <email@hidden>)

  • Prev by Date: Resolving bizarre autolayout crashes.
  • Next by Date: Re: Resolving bizarre autolayout crashes.
  • Previous by thread: Re: dealloc query for NSTableCellView
  • Next by thread: Re: dealloc query for NSTableCellView
  • Index(es):
    • Date
    • Thread