From 929eed47994d715f3ffccbdf47768a13171da968 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Dec 1999 14:14:19 +0000 Subject: [PATCH] wxSetlocale() doesn't always return NULL git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4841 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wxchar.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index baa67e326d..f5f989701a 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -191,9 +191,16 @@ WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_pt #ifndef wxSetlocale WXDLLEXPORT wxChar * wxSetlocale(int category, const wxChar *locale) { - setlocale(category, wxConvLibc.cWX2MB(locale)); - // FIXME - return (wxChar *)NULL; +#ifdef wxUSE_THREADS + wxASSERT_MSG( wxThread::IsMain(), _T("wxSetlocale() is not MT-safe") ); +#endif + + static wxWCharBuffer s_wzLocale; + + char *localeOld = setlocale(category, wxConvLibc.cWX2MB(locale)); + s_wzLocale = wxConvLibc.cMB2WC(localeOld); + + return s_wzLocale; } #endif