From ca9ee2f18d90f6e991f3f7a000a70ffece34546c Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Tue, 9 Oct 2012 17:19:47 -0700 Subject: [PATCH] Don't update settings.locale with our detected locale from OS to avoid the crash caused by CEF loading the resources. Also remove the mappings that we put in before to fix crashes for Chinese OSes and Brazilian Portuguese. --- appshell/cefclient.cpp | 5 ++++- appshell/client_app_mac.mm | 11 ----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/appshell/cefclient.cpp b/appshell/cefclient.cpp index f2ca1bfc8..f3f8e214d 100644 --- a/appshell/cefclient.cpp +++ b/appshell/cefclient.cpp @@ -101,7 +101,10 @@ void AppGetSettings(CefSettings& settings, CefRefPtr app) { } } - CefString(&settings.locale) = app->GetCurrentLanguage(); + // Don't update the settings.locale with the locale that we detected from the OS. + // Otherwise, CEF will use it to find the resources and when it fails in finding resources + // for some locales that are not available in resources, it crashes. + //CefString(&settings.locale) = app->GetCurrentLanguage( ); CefString(&settings.javascript_flags) = g_command_line->GetSwitchValue(cefclient::kJavascriptFlags); diff --git a/appshell/client_app_mac.mm b/appshell/client_app_mac.mm index a7de67558..ee9670848 100644 --- a/appshell/client_app_mac.mm +++ b/appshell/client_app_mac.mm @@ -50,17 +50,6 @@ NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0]; - // Remap zh-Hans --> zh-CN and zh-Hant --> zh-TW so that CEF3 can find the corresponding localized resources. - // We may need to remove these two lines in the future if CEF3 switches to the newer locale names. - language = [language stringByReplacingOccurrencesOfString:@"Hans" withString:@"CN"]; - language = [language stringByReplacingOccurrencesOfString:@"Hant" withString:@"TW"]; - - // Remap pt --> pt-BR so that we can load the CEF3 resource for Brazilian Portuguese. - // [rlim] I believe this is the last one that we have to remap. If we find any to reamp again, - // then we should just switch to CFLocaleCopyPreferredLanguages() instead of [[NSLocale preferredLanguages]. - if ([language isEqualToString:@"pt"]) - language = [language stringByReplacingOccurrencesOfString:@"pt" withString:@"pt-BR"]; - CefString result = [language UTF8String]; return result; }