X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/adf9e09990c79a3645eaa1f69b44d852c11a72f0..10545ca4e7bd875e07830fb17ea0b70b427bc50f:/src/common/intl.cpp diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 50228ca0a1..0d83c0db88 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -614,7 +614,8 @@ bool wxLocale::Init(const wxChar *szName, wxCHECK_MSG( szLocale, FALSE, _T("no locale to set in wxLocale::Init()") ); } - m_pszOldLocale = wxSetlocale(LC_ALL, szLocale); + + m_pszOldLocale = wxStrdup(wxSetlocale(LC_ALL, szLocale)); if ( m_pszOldLocale == NULL ) wxLogError(_("locale '%s' can not be set."), szLocale); @@ -803,12 +804,15 @@ bool wxLocale::Init(int language, int flags) #endif #ifndef WX_NO_LOCALE_SUPPORT - wxChar *szLocale = retloc ? wxStrdup(retloc) : NULL; + wxChar *szLocale = retloc ? wxStrdup(retloc) : NULL; bool ret = Init(name, canonical, retloc, (flags & wxLOCALE_LOAD_DEFAULT) != 0, (flags & wxLOCALE_CONV_ENCODING) != 0); - if (szLocale) - free(szLocale); + free(szLocale); + + if ( ret ) + m_language = lang; + return ret; #endif } @@ -1499,6 +1503,7 @@ wxLocale::~wxLocale() // restore old locale wxSetLocale(m_pOldLocale); wxSetlocale(LC_ALL, m_pszOldLocale); + free((wxChar *)m_pszOldLocale); // const_cast } // get the translation of given string in current locale