• 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: an oldie but a goodie: observing properties of collected objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: an oldie but a goodie: observing properties of collected objects


  • Subject: Re: an oldie but a goodie: observing properties of collected objects
  • From: Ken Thomases <email@hidden>
  • Date: Thu, 17 Jun 2010 20:55:23 -0500

On Jun 17, 2010, at 8:07 PM, Jerry Krinock wrote:

> I was going to ask what happens if this object which owns 5000 widget objects gets deallocated.  Their observers have not been removed and I would expect nastygrams like this [1].  But then I noticed that your observer is 'self'.
>
> Ken, is that part of your scheme, that the observer of the collection must also be the owner of the collection?

No.

> If so, since the objects will be deallocated slightly before the owner is, there is a small window of time where it's observing a deallocated object.  Do you worry about that?

I didn't illustrate it, but you would unregister as an observer from all of the widgets before releasing the widgets array.

And, in general, you should make sure that observers unregister before the observed objects are deallocated.  That's not unique to the technique I described.

Regards,
Ken

_______________________________________________

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: 
 >an oldie but a goodie: observing properties of collected objects (From: Matt Neuburg <email@hidden>)
 >Re: an oldie but a goodie: observing properties of collected objects (From: Ken Thomases <email@hidden>)
 >Re: an oldie but a goodie: observing properties of collected objects (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: mutableArrayValueForKey: truth or dare
  • Next by Date: Re: an oldie but a goodie: observing properties of collected objects
  • Previous by thread: Re: an oldie but a goodie: observing properties of collected objects
  • Next by thread: Re: an oldie but a goodie: observing properties of collected objects
  • Index(es):
    • Date
    • Thread