Make _() and friends safe to call from any thread.
The GetUntranslatedString() hack keeps a global copy of all strings, so that it can return a const reference as wxGetTranslation() return value. A global wxHashSet instance shared by all threads won't do, even guarded with a critical section, because it may internally copy values on any insert and thus invalidate pointers that may still be used on another thread. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74833 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -14,6 +14,13 @@
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxLog;
|
||||
|
||||
#if wxUSE_INTL
|
||||
#include "wx/hashset.h"
|
||||
WX_DECLARE_HASH_SET(wxString, wxStringHash, wxStringEqual,
|
||||
wxLocaleUntranslatedStrings);
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxThreadSpecificInfo: contains all thread-specific information used by wx
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -40,6 +47,11 @@ public:
|
||||
// logging
|
||||
bool loggingDisabled;
|
||||
|
||||
#if wxUSE_INTL
|
||||
// Storage for wxTranslations::GetUntranslatedString()
|
||||
wxLocaleUntranslatedStrings untranslatedStrings;
|
||||
#endif
|
||||
|
||||
private:
|
||||
wxThreadSpecificInfo() : logger(NULL), loggingDisabled(false) {}
|
||||
};
|
||||
|
Reference in New Issue
Block a user