From: Vadim Zeitlin Date: Mon, 6 Dec 1999 14:14:19 +0000 (+0000) Subject: wxSetlocale() doesn't always return NULL X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/929eed47994d715f3ffccbdf47768a13171da968 wxSetlocale() doesn't always return NULL git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4841 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- 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