Re: Stumped by EXEC_BAD_ACCESS
Re: Stumped by EXEC_BAD_ACCESS
- Subject: Re: Stumped by EXEC_BAD_ACCESS
- From: Graham Cox <email@hidden>
- Date: Fri, 31 Jul 2009 14:17:55 +1000
On 31/07/2009, at 6:37 AM, David Blanton wrote:
When I quit my application it ends as expected.
When I close the last window I get the EXEC_BAD_ACCESS message.
Following Greg Parker's 2006 post at CocoaBuilder I get the
following which according to that post respondsToSelector:" is being
called on a nil object. As you can see the object_GetClassName()
which should tell the call the method is being called on also breaks.
Current language: auto; currently objective-c++
Program received signal: “EXC_BAD_ACCESS”.
(gdb) x/s $ecx
0x93c83164 <__FUNCTION__.12370+617988>: "respondsToSelector:"
(gdb) x/8x $esp
0xbfffe758: 0x006ec390 0x90a8283b 0x09d818f0 0x93c83164
0xbfffe768: 0x93c24788 0x94063734 0x09d86750 0xa0078b40
(gdb) p (char *)object_getClassName(0x93c83164)
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x7073657a
0x93be3058 in _class_getName ()
The program being debugged was signaled while in a function called
from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function
(object_getClassName) will be abandoned.
[Oddly if I implement - (void)windowWillClose:(id)sender and call
[NSApp terminate:self]; the problem goes away]
So if there are any other suggestions I am all ears!
It almost certainly an over-release bug somewhere. The app quits
normally because it doesn't bother to call release on everything - it
just dismantles the app's heap. Closing the window does release
things, including something that has been released already, by the
sound of it.
To track this down, turn on NSZombieEnabled in your environment flags
- that should stop in the debugger at the exact place where the
release is made. The problem is that the release that is in error is
likely to be one made earlier, so you'll need to do a bit of detective
work. But knowing which object is being released is 80% of the battle.
Also, experiment with the "release when closed" flag on the window in
IB.
--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