Re: Manual KVO quirks with NSDocument and NSWindowController
Re: Manual KVO quirks with NSDocument and NSWindowController
- Subject: Re: Manual KVO quirks with NSDocument and NSWindowController
- From: Andrew White <email@hidden>
- Date: Wed, 01 Jun 2005 13:48:51 +1000
Tim Lucas wrote:
The second is that when I close the window (and thus the document) I
get an error:
2005-05-23 22:33:40.770 ProgramName[3584] An instance 0x118dc50 of
class MyDocument is being deallocated while key value observers are
still registered with it. Break on _NSKVODeallocateLog to start
debugging.
According to the debugger, "close" is called for DeviceConfigDoc but
"dealloc" is not. I did have code in MyWindowController to stop
observing when the window controller's dealloc was called, but it
doesn't seem to be called. I searched for a NSWindowController
documentWillClose message, but there doesn't seem to be one. Nor can
I find a "windowDidClose" notification - the closest I found was
"close", and that doesn't seem to be called either when I click the
close box.
My guess would be to find the culprit causing dealloc not to be
called... that's your main problem.
I'm not convinced.
To test, I trapped the 'close' call my document controller to manually send
a myDocWillClose: message to all window controllers. Not surprisingly,
there are no window controllers in this list. However, the child WC has
not yet been deallocated.
Obviously, either some third party is holding a retain on the child or the
NSDocument code that deals with closing calls autorelease rather than
release. For now, I'd rather work around the problem completely and hook
either the "disconnect from document" or "my window closed" event in the
NSWindowController, thus allowing me to cleanly de-register KVO.
How do I hook this event?
--
Andrew White
--------------------------------------------------------------------------
This email and any attachments may be confidential. They may contain legally
privileged information or copyright material. You should not read, copy,
use or disclose them without authorisation. If you are not an intended
recipient, please contact us at once by return email and then delete both
messages. We do not accept liability in connection with computer virus,
data corruption, delay, interruption, unauthorised access or unauthorised
amendment. This notice should not be removed.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden