"Application quit unexpectedly"
I'm currently porting a game to MacOSX, and most of it is working, but when I'm press ESC to quit the game, it quits, and the a dialog pops up, saying "<nameofgame> quit unexpectedly, open again or ignore?"
Now, I want to know if anyone knows what is the cause of this behavior.
When the ESC key is pressed, I release all resources in memory, destroy the application window, and call exit(0), what could be the problem?
Now, I want to know if anyone knows what is the cause of this behavior.
When the ESC key is pressed, I release all resources in memory, destroy the application window, and call exit(0), what could be the problem?
You crashed. Run in the debugger, you'll get more info.
You needn't clean anything up when the user quits. Just exit(0) as quickly as possible.
You needn't clean anything up when the user quits. Just exit(0) as quickly as possible.
My guess would be that the crash happens sometime during your attempt to "clean things up" for the quit. As OSC says, don't bother with the other stuff like closing the window or releasing resources, just call exit(0) and be done with it.
I'd guess that you are probably releasing something too early and the OS is killing your app for a segmentation fault. The application window is a suspect. Anything that is instantiated in your main NIB file, as your main window is likely to be, will be destroyed automatically for you when the app quits. If you destroy it programmatically then Cocoa comes along and tries to destroy it again you'll get a segmentation fault.
I'd suggest you look at the run log (add some printf()s to your destructors if you need to) and look for anything suspicious. Also, if see what the debugger says when the app crashes.
On another note, escape shouldn't quit the app anyway. Command-Q is the keyboard shortcut for quit. In a lot of games escape will bring up a menu, but I can't think of any where it quits the game - even on Windows (although, admittedly, it has been a long time since I played any games on Windows).
I'd suggest you look at the run log (add some printf()s to your destructors if you need to) and look for anything suspicious. Also, if see what the debugger says when the app crashes.
On another note, escape shouldn't quit the app anyway. Command-Q is the keyboard shortcut for quit. In a lot of games escape will bring up a menu, but I can't think of any where it quits the game - even on Windows (although, admittedly, it has been a long time since I played any games on Windows).
Hey, thanks for the quick answers!
A crash, true, is probably that, I will check that now
A crash, true, is probably that, I will check that now
Well, removing DisposeWindow before terminating solves the problem (I guess MacOSX automatically destroys windows).
(I'm using Carbon instead of Cocoa, because I'm using Pascal instead of objective C)
(I'm using Carbon instead of Cocoa, because I'm using Pascal instead of objective C)
You do realize that Carbon is deprecated, unavailable in 64-bit, and generally completely without any kind of future, right?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| "Quit gamed and choose restart" | funkboy | 3 | 1,406 |
Dec 20, 2012 08:40 PM Last Post: funkboy |
|
| Enabling the "quit" menu function in an SDL program | ferum | 2 | 3,675 |
Sep 10, 2006 02:35 PM Last Post: PowerMacX |
|

