Weird crash when quitting application or... who put it in the autorelease pool?
Weird crash when quitting application or... who put it in the autorelease pool?
- Subject: Weird crash when quitting application or... who put it in the autorelease pool?
- From: Robert Clair <email@hidden>
- Date: Thu, 22 Jun 2006 17:10:12 -0400
This one is really weird: I have a document based app. If I start the
application, open a new document and then hit CMD-W, CMD-Q in
succession *without releasing the CMD key* the app crashes. If I
release the CMD key between CMD-W and CMD-Q it never happens even if
I do it very rapidly.
On further investigation:
I have a transparent overlay window object. It is owed by the view
beneath it, created when the view starts and released in the view's
dealloc routine. Nothing I do ever calls autorelease on it. But when
I push the keys in rapid succession without releasing the CMD key
something in the system puts it in the autorelease pool:
#0 -[ZGOverlayWindow autorelease] (self=0xdd8f300, _cmd=0x90a91aec)
at /Users/source/system/ZGOverlayWindow.m:72
#1 0x933903c3 in -[NSWindow _close] ()
#2 0x93390214 in -[NSWindow close] ()
#3 0x926f2121 in -[NSArray makeObjectsPerformSelector:withObject:] ()
#4 0x92702de9 in -[NSArray makeObjectsPerformSelector:] ()
#5 0x934f6b0b in -[NSApplication _deallocHardCore:] ()
#6 0x934f660d in -[NSApplication terminate:] ()
#7 0x9345d2fc in -[NSApplication sendAction:to:from:] ()
#8 0x9350b04f in -[NSMenu performActionForItemAtIndex:] ()
#9 0x9350ad91 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:] ()
#10 0x9350a9e8 in -[NSMenu performKeyEquivalent:] ()
#11 0x9350a489 in -[NSApplication _handleKeyEquivalent:] ()
#12 0x9343e3cf in -[NSApplication sendEvent:] ()
#13 0x933695a6 in -[NSApplication run] ()
#14 0x9335d4d7 in NSApplicationMain ()
#15 0x0006cc87 in main (argc=1, argv=0xbffff704) at /Users/source/
system/main.m:28
Again, -[ZGOverlayWindow autorelease] isn't called if I do release
the CMD key between commands.
Being put in the autorelease pool is a bad deal since the object is
properly released on its own and things naturally crash when the pool
is dumped:
#0 0x927d86f8 in -[_NSZombie release] ()
#1 0x90803713 in CFRelease ()
#2 0x90806f3a in __CFArrayReleaseValues ()
#3 0x908037e8 in _CFRelease ()
#4 0x926daaf3 in NSPopAutoreleasePool ()
#5 0x926f9966 in +[NSAutoreleasePool releaseAllPools] ()
#6 0x934f6b53 in -[NSApplication _deallocHardCore:] ()
#7 0x934f660d in -[NSApplication terminate:] ()
#8 0x9345d2fc in -[NSApplication sendAction:to:from:] ()
#9 0x9350b04f in -[NSMenu performActionForItemAtIndex:] ()
#10 0x9350ad91 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:] ()
#11 0x9350a9e8 in -[NSMenu performKeyEquivalent:] ()
#12 0x9350a489 in -[NSApplication _handleKeyEquivalent:] ()
#13 0x9343e3cf in -[NSApplication sendEvent:] ()
#14 0x933695a6 in -[NSApplication run] ()
#15 0x9335d4d7 in NSApplicationMain ()
#16 0x0006cc87 in main (argc=1, argv=0xbffff704) at /Users/source/
system/main.m:28
The sleazy fix is to override autorelease in the overlay window and
not call super but I'd like to understand this. Telling the user to
type more slowly is not an option.
Any enlightenment appreciated.
...Bob Clair
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden