Why does AppKit call into NSDocument's -close multiple times by indirect recursion? Can this be on purpose?

It happens when I have this:

1) A document with unsaved with changes
2) Terminate the app via CMD-Q
3) Answer "Don't Save" in the save-changes-sheet

This doesn't smell right. I override -close and call super right away, doing some cleanup work afterwards. Under some bizarre situations which I have not been able to recreate it gets called up to 4 times.

I'm pasting the call stack (line 366 is the call to super, line 375 is my breakpoint).

Regards
Markus

#0 0x00000001000034d8 in -[MyDocument close] at /Users/markus/Projects/MyApp/src/MyDocument.m:375
#1      0x00007fff8bed7d25 in -[NSWindowController _windowDidClose] ()
#2 0x00007fff8a30ddf0 in -[QLSeamlessDocumentCloser closeWindow:contentFrame:withBlock:] ()
#3      0x00007fff8baa8602 in -[NSWindow _close] ()
#4      0x00007fff8bbe1c74 in -[NSDocument close] ()
#5 0x00000001000033c9 in -[MyDocument close] at /Users/markus/Projects/MyApp/src/MyDocument.m:366 #6 0x00007fff8bbf342e in __-[NSDocumentController closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo:]_block_invoke_3 () #7 0x00007fff8bbf54c5 in -[NSDocumentController _something:didSomething:soContinue:] () #8 0x00007fff8bbd62a8 in __-[NSDocument canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:]_block_invoke_2 () #9 0x00007fff8bbd5ec1 in __-[NSDocument canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:]_block_invoke_11 () #10 0x00007fff8bbe8e08 in -[NSDocument _something:wasPresentedWithResult:soContinue:] ()
#11     0x00007fff8bad8a4d in -[NSAlert didEndAlert:returnCode:contextInfo:] ()
#12     0x00007fff8bae53df in -[NSApplication endSheet:returnCode:] ()
#13     0x00007fff8bad8913 in -[NSAlert buttonPressed:] ()
#14     0x00007fff8053770d in -[NSObject performSelector:withObject:] ()
#15     0x00007fff8b934f7e in -[NSApplication sendAction:to:from:] ()
#16     0x00007fff8b934eb2 in -[NSControl sendAction:to:] ()
#17     0x00007fff8b934ddd in -[NSCell _sendActionFrom:] ()
#18     0x00007fff8b9342a0 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:] 
()
#19     0x00007fff8b9b3fc4 in -[NSButtonCell 
trackMouse:inRect:ofView:untilMouseUp:] ()
#20     0x00007fff8b932eaa in -[NSControl mouseDown:] ()
#21     0x00007fff8b8fe348 in -[NSWindow sendEvent:] ()
#22     0x00007fff8b897a55 in -[NSApplication sendEvent:] ()
#23     0x00007fff8bae427e in -[NSApplication _shouldTerminate] ()
#24     0x00007fff8b838115 in -[NSApplication terminate:] ()
#25 0x000000010001a4a3 in -[AppDelegate terminate:] at /Users/markus/Projects/rubiTrack/src/AppDelegate.m:219
#26     0x00007fff8053770d in -[NSObject performSelector:withObject:] ()
#27     0x00007fff8b934f7e in -[NSApplication sendAction:to:from:] ()
#28     0x00007fff8ba21bfb in -[NSMenuItem _corePerformAction] ()
#29 0x00007fff8ba21932 in -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] ()
#30     0x00007fff8b99f524 in -[NSMenu performKeyEquivalent:] ()
#31     0x00007fff8b99e175 in -[NSApplication _handleKeyEquivalent:] ()
#32     0x00007fff8b897536 in -[NSApplication sendEvent:] ()
#33     0x00007fff8b82e0c6 in -[NSApplication run] ()
#34     0x00007fff8baaa244 in NSApplicationMain ()
#35     0x000000010000b552 in main at /Users/markus/Projects/MyApp/src/main.m:22
#36     0x00000001000021c4 in start ()

--
__________________________________________
Markus Spoettl
_______________________________________________

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

Reply via email to