Re: NSFontPanel swamping the responder chain (and crashing)
Re: NSFontPanel swamping the responder chain (and crashing)
- Subject: Re: NSFontPanel swamping the responder chain (and crashing)
- From: Graham Cox <email@hidden>
- Date: Wed, 20 May 2015 12:26:23 +1000
> On 20 May 2015, at 12:15 pm, Graham Cox <email@hidden> wrote:
>
>> 'd start by looking at frame #4.
>
>
>> The only code of mine involved is at line 4 which is where I overrode targetForAction:to:from to see what was being called from where, and then calls super.
>
Just to be clear: it crashes when there is no involvement of my code at all - this is the stack trace without the override, but with zombies enabled:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x00007fff91e9fd20 ___forwarding___ + 768
1 com.apple.CoreFoundation 0x00007fff91e9f998 _CF_forwarding_prep_0 + 120
2 com.apple.AppKit 0x00007fff8cdf23c7 -[NSWindow supplementalTargetForAction:sender:] + 240
3 com.apple.AppKit 0x00007fff8cdf1f74 _objectFromResponderChainWhichRespondsToAction + 227
4 com.apple.AppKit 0x00007fff8cdf1ac0 _NSTargetForSendAction + 2861
5 com.apple.AppKit 0x00007fff8cdf0e3e -[NSApplication targetForAction:to:from:] + 329
6 com.apple.AppKit 0x00007fff8d07b102 -[NSFontPanel _canShowEffects] + 44
7 com.apple.AppKit 0x00007fff8d07b0bb -[NSFontPanel _showEffects] + 31
8 com.apple.AppKit 0x00007fff8d07a675 -[NSFontPanel windowDidUpdate:] + 537
9 com.apple.CoreFoundation 0x00007fff91f1345c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
10 com.apple.CoreFoundation 0x00007fff91e03634 _CFXNotificationPost + 3140
11 com.apple.Foundation 0x00007fff975a59d1 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
12 com.apple.CoreFoundation 0x00007fff91e88d80 -[NSArray makeObjectsPerformSelector:] + 496
13 com.apple.AppKit 0x00007fff8ccac5ea -[NSApplication(NSWindowCache) _updateWindowsUsingCache] + 495
14 com.apple.AppKit 0x00007fff8ccac399 -[NSApplication updateWindows] + 70
15 com.apple.AppKit 0x00007fff8d0a181f __38-[NSApplication setWindowsNeedUpdate:]_block_invoke2510 + 76
16 com.apple.CoreFoundation 0x00007fff91e73127 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
17 com.apple.CoreFoundation 0x00007fff91e73080 __CFRunLoopDoObservers + 368
18 com.apple.CoreFoundation 0x00007fff91e65188 __CFRunLoopRun + 872
19 com.apple.CoreFoundation 0x00007fff91e64bd8 CFRunLoopRunSpecific + 296
20 com.apple.HIToolbox 0x00007fff9729656f RunCurrentEventLoopInMode + 235
21 com.apple.HIToolbox 0x00007fff972961ee ReceiveNextEventCommon + 179
22 com.apple.HIToolbox 0x00007fff9729612b _BlockUntilNextEventMatchingListInModeWithFilter + 71
23 com.apple.AppKit 0x00007fff8ccaa9bb _DPSNextEvent + 978
24 com.apple.AppKit 0x00007fff8cca9f68 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
25 com.apple.AppKit 0x00007fff8cc9fbf3 -[NSApplication run] + 594
26 com.apple.AppKit 0x00007fff8cc1c354 NSApplicationMain + 1832
At line 2, it’s clearly trying to access a NSWindow zombie. I’m pretty sure this is the window I just closed that closed the document. It’s hard to be 100% certain because the same result does not arise in the debugger - I have to export a complete app to see the problem, so I can’t examine the window’s address directly. However, this is the only window that has ever closed in the entire run.
So, NSApplication has a stale reference to a closed window which it accesses in _objectFromResponderChainWhichRespondsToAction.
How is that possible?
—Graham
_______________________________________________
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