Restore Win32 locale in wxLocale destructor

This commit is contained in:
Václav Slavík
2021-04-17 10:42:50 +02:00
parent c9e2143a7a
commit b466e3c769
2 changed files with 11 additions and 0 deletions

View File

@@ -363,6 +363,9 @@ private:
const char *m_pszOldLocale; // previous locale from setlocale()
wxLocale *m_pOldLocale; // previous wxLocale
#ifdef __WIN32__
wxUint32 m_oldLCID;
#endif
bool m_initialized;

View File

@@ -253,6 +253,9 @@ void wxLocale::DoCommonInit()
if ( m_pszOldLocale )
m_pszOldLocale = wxStrdup(m_pszOldLocale);
#ifdef __WIN32__
m_oldLCID = ::GetThreadLocale();
#endif
m_pOldLocale = wxSetLocale(this);
@@ -1098,6 +1101,11 @@ wxLocale::~wxLocale()
wxSetlocale(LC_ALL, m_pszOldLocale);
free(const_cast<char *>(m_pszOldLocale));
}
#ifdef __WIN32__
::SetThreadLocale(m_oldLCID);
wxMSWSetThreadUILanguage(LANGIDFROMLCID(m_oldLCID));
#endif
}