On Feb 25, 2008, at 8:38 PM, Rob Keniger wrote:
On 26/02/2008, at 1:02 AM, glenn andreas wrote:
Note that in the non-GC world, you can't do that in -dealloc (since the KVO "warning" about deallocating something that is still be observed happens before the call to dealloc), so it's unclear if there isn't some similar helpful warning before -finalize is called...
Actually, I just checked this and you're right, calling - removeObserver:forKeyPath: in a -finalize method triggers a warning. You would need to do this elsewhere, although the documentation is particularly scant as to exactly where.

In general, -finalize should not be used to manage scarce resource nor muck around with the app's object graph, including tearing down observations and the like.

You will likely want to have some kind of an "I'm done with you, tear yourself down at this known, predictable, good time to do so" method. An -invalidate or -disconnect or -done or the like.

b.bum

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to