> On 15 Jun 2017, at 20:03, Quincey Morris > <quinceymor...@rivergatesoftware.com> wrote: > > On Jun 15, 2017, at 04:46 , Jonathan Mitchell <li...@mugginsoft.com> wrote: >> >> The crash occurs when the pool gets drained. > >> Wrapping my -bind: calls in a release pool solves the issue too. > > The information you’ve provided doesn’t make a lot of sense by itself. If > draining an autorelease pool is leading to a crash, then putting the affected > objects in a different autorelease pool and draining *that* should also crash. Thanks for the reply.
Sorry that wasn’t clear. The crash occurs when the default application created thread pool gets drained. It doesn’t crash if I supply a local thread pool that just wraps the -bind:. Its the timing of when the relevant pool gets drained that seems to be important. I don’t know what effect the release optimisation is having to cause this issue to appear. > > Have you tried turning on Zombies to find out which incorrect reference is > being followed? > Yes. 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. But I don’t set self.view.nextResponder to nil in dealloc and this causes the crash in loc_307c88: as view.nextResponder == deallocated NSWindow instance. But setting self.view.nextResponder to nil in dealloc would affect responder chain patching for all view controllers and may have unwanted results. So I will need to think about that. void -[NSViewController _removeFromResponderChain](void * self, void * _cmd) { r14 = self; if ([self _viewControllerSupports10_10Features] == 0x0) goto .l1; loc_307c3c: r12 = r14->view; rax = [r12 nextResponder]; if (rax == 0x0) goto .l1; loc_307c63: rbx = rax; if (rbx == r14) goto loc_307c88; loc_307c6b: rax = [rbx nextResponder]; r12 = rbx; if (rax != 0x0) goto loc_307c63; .l1: return; loc_307c88: [r12 setNextResponder:[r14 nextResponder]]; return; } J _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com