iDevGames Forums
Random EXC_BAD_ACCESS - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Random EXC_BAD_ACCESS (/thread-1765.html)

Random EXC_BAD_ACCESS - bmpix - Feb 13, 2009 10:04 AM

Hey guys,
I'm completely stuck.
I'm finishing a quite large iphone project and only a few dialogs left, everything else works fine. And this is a problem!
Ok, so I've got "settings" button in the main menu in my app, and when you tap it, a new dialog (class inherited from UIView) should appear. The thing is when you tap it, the app crashes _sometimes_. Sometimes it works well, the dialog appears as I want to and works pretty fine.
It crashes in a random place, with random stack, and the only thing the debugger says is Program received signal: “EXC_BAD_ACCESS”.
I've rewritten the dialog completely from scratch, it had no effect.
Yes, I have tried GuardMalloc - nothing, NSZombies - nothing.
Maybe you have any ideas?

Random EXC_BAD_ACCESS - dcavanagh - Feb 15, 2009 08:40 PM

Perhaps some code excerpts from where you're calling the settings view would help...

Random EXC_BAD_ACCESS - smallstepforman - Feb 17, 2009 10:54 PM

Lock, lock, and just to be sure, lock again. When in doubt, lock.

By lock, I mean protect the rendering thread with a semaphore/mutex/whatever. Dont render in the background while Cocoa is doing something funky in the foreground (especially with dialogs/modal windows).

Also, some Apple components are buggy as hell. For example, dont enable accelerometer and UIImagePicker at the same time, otherwise you'll crash (learned this the hard way).

Try to revert to a state where you wern't crashing, add components until you find something which doesn't jibe well with the other components. Then lock.

Did I say Lock?