Locale is dynamic now, since wxLocale does not support re-initialization (when module is reused)

This commit is contained in:
Simon Rozman 2017-02-22 09:42:18 +01:00
parent 48d46617d2
commit 8fbcf27f6a

View File

@ -43,7 +43,7 @@ public:
protected: protected:
static wxCriticalSection s_lock; ///< Initialization lock static wxCriticalSection s_lock; ///< Initialization lock
static unsigned long s_init_ref_count; ///< Initialization reference counter static unsigned long s_init_ref_count; ///< Initialization reference counter
static wxLocale s_locale; ///< Locale static wxLocale *s_locale; ///< Locale
}; };
@ -543,9 +543,10 @@ wxInitializerPeer::wxInitializerPeer(_In_ HINSTANCE instance)
// Do our wxWidgets configuration and localization initialization. // Do our wxWidgets configuration and localization initialization.
wxInitializeConfig(); wxInitializeConfig();
if (wxInitializeLocale(s_locale)) { s_locale = new wxLocale;
s_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion)); if (wxInitializeLocale(*s_locale)) {
s_locale.AddCatalog(wxT("EAPTTLSUI")); s_locale->AddCatalog(wxT("wxExtend") wxT(wxExtendVersion));
s_locale->AddCatalog(wxT("EAPTTLSUI"));
} }
} }
@ -557,9 +558,14 @@ wxInitializerPeer::~wxInitializerPeer()
return; return;
wxEntryCleanup(); wxEntryCleanup();
if (s_locale) {
delete s_locale;
s_locale = NULL;
}
} }
wxCriticalSection wxInitializerPeer::s_lock; wxCriticalSection wxInitializerPeer::s_lock;
unsigned long wxInitializerPeer::s_init_ref_count = 0; unsigned long wxInitializerPeer::s_init_ref_count = 0;
wxLocale wxInitializerPeer::s_locale; wxLocale *wxInitializerPeer::s_locale = NULL;