Re: Trying to understand/prevent crash using restorableStateKeyPaths in NSPersistentUI Work
Re: Trying to understand/prevent crash using restorableStateKeyPaths in NSPersistentUI Work
- Subject: Re: Trying to understand/prevent crash using restorableStateKeyPaths in NSPersistentUI Work
- From: Quincey Morris <email@hidden>
- Date: Mon, 29 Jul 2013 21:22:46 -0700
On Jul 29, 2013, at 21:03 , Lee Ann Rucker <email@hidden> wrote:
> The main thread got stopped shortly after the first call to [wc window] - not in any restorable value's setter, though; that would've been obvious - but the actual crash was in a different thread. It's definitely at a point where one or more restorable values would already have been set.
>
> I close my windows by the equivalent of
> [[wc window] setDelegate:nil]; // delegate is not the windowController.
> [wc close];
> [wc release];
I don't understand whether you're saying you get a crash after closing the window (which is how I understand Eric's problem), or after the state is restored (i.e. when the window is re-opened, more or less).
> Never considered clearing the windowController; what effect would that have on the window?
I'm not sure you can/should try to change that property yourself. But I kind of mis-stated my point. I was trying to say that window might have non-owning references to the window controller. If those references exist (such as in self.delegate) after the window controller is deallocated, you're clearly vulnerable to a crash. You might avoid this by ensuring the references no longer exist (manually clearing window.delegate, and perhaps the window controller itself clears the windowController property in its dealloc). OTOH, it might not be the dangling reference causing the problem, but rather the need to extend the life of the window controller. All this conditionality makes the point hard to say, which is why I'm probably not saying it very well.
_______________________________________________
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