Don't call setlocale("") on startup by default any longer.

This undoes the changes of r44773 because calling setlocale() resulted in C
locale being set differently from C++ locale which was confusing and led to
huge slowdowns in any code using std::stream with at least MinGW. And setting
the C++ locale to be the same, as r72719 tried to do, doesn't seem to be
practical as it results in immediate crashes under OS X and MinGW when used
under XP.

Do provide wxApp::SetCLocale() helper to explicitly do what was previously
done implicitly, even though currently it is a trivial wrapper for setlocale()
and we don't even need to call gtk_set_locale() as it has never done anything
else and is deprecated since GTK+ 2.24.

Closes #14780.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72951 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-11-14 13:46:50 +00:00
parent 40df8a51f2
commit b51014176a
9 changed files with 65 additions and 64 deletions

View File

@@ -174,10 +174,6 @@ wxAppConsoleBase::~wxAppConsoleBase()
bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **WXUNUSED(argv))
{
#if wxUSE_INTL
GetTraits()->SetLocale();
#endif // wxUSE_INTL
return true;
}
@@ -784,6 +780,18 @@ void wxAppConsoleBase::OnAssert(const wxChar *file,
OnAssertFailure(file, line, NULL, cond, msg);
}
// ----------------------------------------------------------------------------
// Miscellaneous other methods
// ----------------------------------------------------------------------------
void wxAppConsoleBase::SetCLocale()
{
// We want to use the user locale by default in GUI applications in order
// to show the numbers, dates &c in the familiar format -- and also accept
// this format on input (especially important for decimal comma/dot).
wxSetlocale(LC_ALL, "");
}
// ============================================================================
// other classes implementations
// ============================================================================
@@ -836,26 +844,6 @@ bool wxConsoleAppTraitsBase::HasStderr()
// wxAppTraits
// ----------------------------------------------------------------------------
#if wxUSE_INTL
void wxAppTraitsBase::SetLocale()
{
// We want to use the user locale by default in GUI applications in order
// to show the numbers, dates &c in the familiar format -- and also accept
// this format on input (especially important for decimal comma/dot).
wxSetlocale(LC_ALL, "");
#if wxUSE_STL
// At least in some environments, e.g. MinGW-64, if the global C++ locale
// is different from the global C locale, all stream operations temporarily
// change the locale resulting in a huge slowdown (3 times slower in some
// real-life applications), so change the C++ locale to match.
std::locale::global(std::locale(""));
#endif //wxUSE_STL
wxUpdateLocaleIsUtf8();
}
#endif
#if wxUSE_THREADS
void wxMutexGuiEnterImpl();
void wxMutexGuiLeaveImpl();