From 4c31f60bba890e5c320c4bc6fd0ca1c5ce741830 Mon Sep 17 00:00:00 2001 From: Lynx Linden Date: Tue, 22 Jun 2010 18:33:39 +0100 Subject: EXT-7926 FIXED Fixed crash opening About for non-English locales. Calling std::locale("fr_FR.UTF-8") crashes on Linux and Mac. Or rather, it throws an exception when it doesn't know the locale and we didn't handle the exception. I now catch the exception and output an error rather than crash. Note, this happened because of change 703f3bcf7069, which made us actually pass a real locale string instead of just "C". So, we were never actually supporting a locale for LLStringUtil::formatNumber(). There is therefore an open task of making formatNumber() actually respect the locale. I'll report a separate JIRA to capture that task. --- indra/llcommon/llstring.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index f14d947734..f5eb552d99 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -994,7 +994,14 @@ void LLStringUtil::formatNumber(std::string& numStr, std::string decimals) convertToS32 (decimals, intDecimals); if (!sLocale.empty()) { - strStream.imbue (std::locale(sLocale.c_str())); + // imbue() throws if the locale is unknown! (EXT-7926) + try + { + strStream.imbue(std::locale(sLocale.c_str())); + } catch (const std::exception &e) + { + LL_WARNS_ONCE("Locale") << "Cannot set locale to " << sLocale << LL_ENDL; + } } if (!intDecimals) -- cgit v1.2.3 From ccad528d5fb5889e9826ca045de5e7315be5942e Mon Sep 17 00:00:00 2001 From: Lynx Linden Date: Tue, 22 Jun 2010 18:55:04 +0100 Subject: EXT-7926 FIXED Minor typo correction. --- indra/llcommon/llstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index f5eb552d99..ffdac5d411 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -994,7 +994,7 @@ void LLStringUtil::formatNumber(std::string& numStr, std::string decimals) convertToS32 (decimals, intDecimals); if (!sLocale.empty()) { - // imbue() throws if the locale is unknown! (EXT-7926) + // std::locale() throws if the locale is unknown! (EXT-7926) try { strStream.imbue(std::locale(sLocale.c_str())); -- cgit v1.2.3 From dfc20a824944d372c6978ca7b89289ec542554a9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 22 Jun 2010 14:59:34 -0400 Subject: EXT-7926: Remove unreferenced catch-clause variable (MSVC error). --- indra/llcommon/llstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index ffdac5d411..1561bda201 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -998,7 +998,7 @@ void LLStringUtil::formatNumber(std::string& numStr, std::string decimals) try { strStream.imbue(std::locale(sLocale.c_str())); - } catch (const std::exception &e) + } catch (const std::exception &) { LL_WARNS_ONCE("Locale") << "Cannot set locale to " << sLocale << LL_ENDL; } -- cgit v1.2.3 From f388efa49a75206223137c328f2a1fe0853d02a7 Mon Sep 17 00:00:00 2001 From: palange Date: Tue, 22 Jun 2010 13:03:56 -0700 Subject: EXT-7925 FIX Added NSTreatUnknownArgumentsAsOpen to setupCocoa() to prevent pop-ups --- indra/llwindow/llwindowmacosx-objc.mm | 5 ++++ indra/newview/Info-SecondLife.plist | 48 +++++++++++++++++------------------ 2 files changed, 29 insertions(+), 24 deletions(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 59b25e1726..3a822a93a6 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -49,6 +49,11 @@ void setupCocoa() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents. + // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' + // when init'ing the Cocoa App window. + [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; + // This is a bit of voodoo taken from the Apple sample code "CarbonCocoa_PictureCursor": // http://developer.apple.com/samplecode/CarbonCocoa_PictureCursor/index.html diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist index 97e24a0bd5..9bc95f9b95 100644 --- a/indra/newview/Info-SecondLife.plist +++ b/indra/newview/Info-SecondLife.plist @@ -1,5 +1,5 @@ - + CFBundleDevelopmentRegion @@ -18,33 +18,33 @@ APPL CFBundleSignature ???? - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - slurl - - CFBundleTypeIconFile - seconlife - CFBundleTypeMIMETypes - - application/x-grid-location-info - - CFBundleTypeName - Secondlife SLURL + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + slurl + + CFBundleTypeIconFile + seconlife + CFBundleTypeMIMETypes + + application/x-grid-location-info + + CFBundleTypeName + Secondlife SLURL CFBundleTypeOSTypes - SLRL + SLRL - CFBundleTypeRole - Viewer - LSTypeIsPackage + CFBundleTypeRole + Viewer + LSTypeIsPackage - NSDocumentClass - SecondLifeSLURL - - + NSDocumentClass + SecondLifeSLURL + + CFBundleURLTypes -- cgit v1.2.3