From be0d5da341cf3f33ba2d7cca8c979abf9d94f683 Mon Sep 17 00:00:00 2001 From: Ankit Meel Date: Fri, 29 Oct 2021 10:11:04 +0200 Subject: Fix T88877: 2.93: Crash on recent OSX with a non-English locale. Looks like OSX changed the default format of its locale, which is not valid anymore for gettext/boost::locale. Solution based on investigations and patch by Kieun Mun (@kieuns), with some further tweaks by Ankit Meel (@ankitm), many thanks. Also add an exception catcher on `std::runtime_error` in `bl_locale_set()`, since in OSX catching the ancestor `std::exception` does not work with `boost::locale::conv::conversion_error` and the like for some reasons. Reviewed By: #platform_macos, brecht Maniphest Tasks: T88877 Differential Revision: https://developer.blender.org/D13019 --- intern/locale/boost_locale_wrapper.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'intern/locale/boost_locale_wrapper.cpp') diff --git a/intern/locale/boost_locale_wrapper.cpp b/intern/locale/boost_locale_wrapper.cpp index 73433fe7c5e..ede9377b38f 100644 --- a/intern/locale/boost_locale_wrapper.cpp +++ b/intern/locale/boost_locale_wrapper.cpp @@ -117,6 +117,13 @@ void bl_locale_set(const char *locale) #undef LOCALE_INFO } + // Extra catch on `std::runtime_error` is needed for macOS/Clang as it seems that exceptions + // like `boost::locale::conv::conversion_error` (which inherit from `std::runtime_error`) are + // not caught by their ancestor `std::exception`. See + // https://developer.blender.org/T88877#1177108 . + catch (std::runtime_error const &e) { + std::cout << "bl_locale_set(" << locale << "): " << e.what() << " \n"; + } catch (std::exception const &e) { std::cout << "bl_locale_set(" << locale << "): " << e.what() << " \n"; } -- cgit v1.2.3