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 (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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to