diff options
author | Bernhard Liebl <Bernhard.Liebl@gmx.org> | 2018-01-15 09:20:45 +0100 |
---|---|---|
committer | Bernhard Liebl <Bernhard.Liebl@gmx.org> | 2018-01-15 09:31:12 +0100 |
commit | 3ff18ee61e4a29c58a106b28bd0f1787f408eba8 (patch) | |
tree | 913c6fb17c73f527c021952e693fbb92f2f35efe /platform/osx | |
parent | 859ac6233d79a8e699de7f8cd2d16238d8887dfe (diff) |
Catch NSException in macOS run loop to prevent crashs
Diffstat (limited to 'platform/osx')
-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 8369adbb5f..83c29c7a1c 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -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(); |