mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Catch NSException in macOS run loop to prevent crashs
This commit is contained in:
parent
859ac6233d
commit
3ff18ee61e
@ -2148,12 +2148,21 @@ void OS_OSX::run() {
|
||||
//int frames=0;
|
||||
//uint64_t frame=0;
|
||||
|
||||
while (!force_quit) {
|
||||
bool quit = false;
|
||||
|
||||
process_events(); // get rid of pending events
|
||||
joypad_osx->process_joypads();
|
||||
if (Main::iteration() == true)
|
||||
break;
|
||||
while (!force_quit && !quit) {
|
||||
|
||||
@try {
|
||||
|
||||
process_events(); // get rid of pending events
|
||||
joypad_osx->process_joypads();
|
||||
|
||||
if (Main::iteration() == true) {
|
||||
quit = true;
|
||||
}
|
||||
} @catch (NSException *exception) {
|
||||
ERR_PRINTS("NSException: " + String([exception reason].UTF8String));
|
||||
}
|
||||
};
|
||||
|
||||
main_loop->finish();
|
||||
|
Loading…
Reference in New Issue
Block a user