On Jun 15, 2017, at 12:55 , Jonathan Mitchell <[email protected]> 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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to