From 0abae8fe0e2f954d68d6c84c933240b9f9f738dc Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Wed, 22 Feb 2017 09:42:18 +0100 Subject: [PATCH] Locale is dynamic now, since wxLocale does not support re-initialization (when module is reused) --- lib/TTLS_UI/src/Module.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/TTLS_UI/src/Module.cpp b/lib/TTLS_UI/src/Module.cpp index f920029..58aa242 100644 --- a/lib/TTLS_UI/src/Module.cpp +++ b/lib/TTLS_UI/src/Module.cpp @@ -37,7 +37,7 @@ public: protected: static wxCriticalSection s_lock; ///< Initialization lock static unsigned long s_init_ref_count; ///< Initialization reference counter - static wxLocale s_locale; ///< Locale + static wxLocale *s_locale; ///< Locale }; @@ -343,9 +343,10 @@ wxInitializerPeer::wxInitializerPeer(_In_ HINSTANCE instance) // Do our wxWidgets configuration and localization initialization. wxInitializeConfig(); - if (wxInitializeLocale(s_locale)) { - s_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion)); - s_locale.AddCatalog(wxT("EAPTTLSUI")); + s_locale = new wxLocale; + if (wxInitializeLocale(*s_locale)) { + s_locale->AddCatalog(wxT("wxExtend") wxT(wxExtendVersion)); + s_locale->AddCatalog(wxT("EAPTTLSUI")); } } @@ -357,9 +358,14 @@ wxInitializerPeer::~wxInitializerPeer() return; wxEntryCleanup(); + + if (s_locale) { + delete s_locale; + s_locale = NULL; + } } wxCriticalSection wxInitializerPeer::s_lock; unsigned long wxInitializerPeer::s_init_ref_count = 0; -wxLocale wxInitializerPeer::s_locale; +wxLocale *wxInitializerPeer::s_locale = NULL;