I have an NSTextView which I programmatically create within the content view of my window. Under certain circumstances I need to programmatically terminate the edit and destroy the NSTextView. When I do this (by setting first responder to nil, removeFromSuperview and releasing my pointer) the dealloc on the NSTextView is not called - until I move my mouse outside of the window content view. It's as though the window is caching a reference to the NSTextView and only releasing it when it decides that I'm no longer interacting with the window. This wouldn't be a problem except that this then messes up the undo grouping for the associated textContainer.
Bit of an obscure one - but if anyone has any knowledge of this I'd love to hear from you!
Thanks