diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2018-05-13 23:51:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-13 23:51:20 +0200 |
commit | 0db3d1d2a754aa122bcbb6ed74cf6f10ba3fc859 (patch) | |
tree | edceea154fa8f4a38383de32237930724ccc2676 | |
parent | af6513b7ff8ee5887ac8ed2e2065daa918898a2d (diff) | |
parent | 3ff18ee61e4a29c58a106b28bd0f1787f408eba8 (diff) |
Merge pull request #15739 from poke1024/macos-catch-exception
Catch NSException in macOS run loop to prevent crashs
-rw-r--r-- | platform/osx/os_osx.mm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 04632e8a11..bde0b4e898 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -2427,12 +2427,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(); |