call GetCache() from a global object ctor to ensure that it is done before any threads are created
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -60,10 +60,25 @@ const size_t wxString::npos = (size_t) -1;
|
||||
|
||||
#if wxUSE_STRING_POS_CACHE
|
||||
|
||||
struct wxStrCacheInitializer
|
||||
{
|
||||
wxStrCacheInitializer()
|
||||
{
|
||||
// calling this function triggers s_cache initialization in it, and
|
||||
// from now on it becomes safe to call from multiple threads
|
||||
wxString::GetCache();
|
||||
}
|
||||
};
|
||||
|
||||
static wxStrCacheInitializer gs_stringCacheInit;
|
||||
|
||||
// gdb seems to be unable to display thread-local variables correctly, at least
|
||||
// not my 6.4.98 version under amd64, so provide this debugging helper to do it
|
||||
#ifdef __WXDEBUG__
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct wxStrCacheDumper
|
||||
{
|
||||
static void ShowAll()
|
||||
@@ -85,6 +100,8 @@ struct wxStrCacheDumper
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void wxDumpStrCache() { wxStrCacheDumper::ShowAll(); }
|
||||
|
||||
#endif // __WXDEBUG__
|
||||
|
||||
Reference in New Issue
Block a user