On Jul 2, 2009, at 10:34, Sean McBride wrote:

I'm trying to find somewhere to undo what was done in my NSDocument
subclass' initializer. Specifically, to start/stop KVO observation. It
seemed like 'close' would be a good place.

'close' isn't a good place, because it isn't necessarily called. If you look at the Leopard Developer Release Notes:

        http://developer.apple.com/releasenotes/Cocoa/AppKit.html

in the section entitled "Advice for Overriders of Methods that Follow the delegate:didSomethingSelector:contextInfo: Pattern", you'll find a nice little code snippet that happens to show you where to place code that should execute just before a document closes:

        if (shouldClose) {
// Here we can do all sorts of things with this document that's about to be closed.
        }

Does that help?


_______________________________________________

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