Re: NSSplitView crash upon restore from 10.8 Versions Browser
Re: NSSplitView crash upon restore from 10.8 Versions Browser
- Subject: Re: NSSplitView crash upon restore from 10.8 Versions Browser
- From: Jerry Krinock <email@hidden>
- Date: Tue, 21 Aug 2012 14:49:40 -0700
On 2012 Aug 20, at 14:14, Kevin Perry <email@hidden> wrote:
> Looks like the crash is happening while attempting to invoke -respondsToSelector:.
>
> Odds are that this is a message being sent to [self delegate], which looks like a deallocated object.
Thank you, Kevin. I like it.
> Is it possible that the split view is outliving its delegate? Typically, when a delegate gets deallocated (or when you release it for the last time), you are responsible for calling setDelegate:nil on anything that you had previously set it as a delegate for.
Yes. After restoring from the Versions Browser, the original document and its window must be closed and deallocced. The split view's delegate is the nib's FIle's Owner. It's wired in the nib. But, because this document can be run in a GUI-less tool, the nib File's Owner is the window controller instead of the document. Such a crash is therefore plausible.
I've dealt with such crashes upon window closing previously, and have a "tearDown" method in which I remove observers, manual bindings, and delegates. So I've just added [splitView setDelegate:nil] to it.
On 2012 Aug 20, at 15:41, Lee Ann Rucker <email@hidden> wrote:
> I really wish the converse of awakeFromNib was public so we could do our own pre-dealloc nib teardown when we need to.
Yes, that would be nice. In its absence, I register for NSWindowWillCloseNotification, and also override -[NSDocument close], with some "only do this once" checking, to run my -tearDown.
Jerry
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden