From b466e3c76981f721533a9bf8b00934d32b0e964e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sat, 17 Apr 2021 10:42:50 +0200 Subject: [PATCH] Restore Win32 locale in wxLocale destructor --- include/wx/intl.h | 3 +++ src/common/intl.cpp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/include/wx/intl.h b/include/wx/intl.h index d66e3043d8..c551042754 100644 --- a/include/wx/intl.h +++ b/include/wx/intl.h @@ -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; diff --git a/src/common/intl.cpp b/src/common/intl.cpp index e56425b619..6ec7ed6f28 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -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(m_pszOldLocale)); } + +#ifdef __WIN32__ + ::SetThreadLocale(m_oldLCID); + wxMSWSetThreadUILanguage(LANGIDFROMLCID(m_oldLCID)); +#endif }