Re: Release mode bindings crash and release pools
Re: Release mode bindings crash and release pools
- Subject: Re: Release mode bindings crash and release pools
- From: Quincey Morris <email@hidden>
- Date: Thu, 15 Jun 2017 13:41:58 -0700
On Jun 15, 2017, at 12:55 , Jonathan Mitchell <email@hidden> wrote:
>
> The NSViewController is calling its internal implementation that removes
> itself from the responder chain - _removeFromResponderChain
> This method calls [NSWindow nextResponder] and the crash occurs there as the
> NSWindow is a zombie.
>
> The nextResponder property uses assign memory semantics so it is prone to
> this sort of thing.
> In my NSViewController subclass I already set self.nextResponder to nil in
> dealloc.
Since macOS 10.10 (where NSViewController instances add themselves to the
responder chain), you should not be setting self.nextResponder to nil *ever*,
nor manipulating the responder chain at all in regard to view controllers.
If the window is already deallocated at the time the view controller tries to
remove itself from the responder chain, then something seems to have gone wrong
earlier. To get this result, the window would have to neglect to cause its view
hierarchy and view controllers to be removed from the responder chain before
deallocating, and something else would have to have kept the view hierarchy
and/or view controllers alive beyond the window’s lifetime.
I still think the autorelease pool behavior is a red herring.
_______________________________________________
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