Catch NSException in macOS run loop to prevent crashs

(cherry picked from commit 3ff18ee61e)
This commit is contained in:
Bernhard Liebl 2018-01-15 09:20:45 +01:00 committed by Rémi Verschelde
parent 5a89810238
commit ac1520325c
1 changed files with 14 additions and 5 deletions

View File

@ -2219,12 +2219,21 @@ void OS_OSX::run() {
//int frames=0; //int frames=0;
//uint64_t frame=0; //uint64_t frame=0;
while (!force_quit) { bool quit = false;
process_events(); // get rid of pending events while (!force_quit && !quit) {
joypad_osx->process_joypads();
if (Main::iteration() == true) @try {
break;
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(); main_loop->finish();