summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/ThreadGlobalData.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/ThreadGlobalData.cpp')
-rw-r--r--WebCore/platform/ThreadGlobalData.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/WebCore/platform/ThreadGlobalData.cpp b/WebCore/platform/ThreadGlobalData.cpp
index 903af66..a43e9bd 100644
--- a/WebCore/platform/ThreadGlobalData.cpp
+++ b/WebCore/platform/ThreadGlobalData.cpp
@@ -32,7 +32,7 @@
#include "ThreadTimers.h"
#include <wtf/UnusedParam.h>
-#if USE(ICU_UNICODE)
+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID)
#include "TextCodecICU.h"
#endif
@@ -72,7 +72,10 @@ ThreadGlobalData::ThreadGlobalData()
, m_atomicStringTable(new HashSet<StringImpl*>)
, m_eventNames(new EventNames)
, m_threadTimers(new ThreadTimers)
-#if USE(ICU_UNICODE)
+#ifndef NDEBUG
+ , m_isMainThread(isMainThread())
+#endif
+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID)
, m_cachedConverterICU(new ICUConverterWrapper)
#endif
#if PLATFORM(MAC)
@@ -86,7 +89,7 @@ ThreadGlobalData::~ThreadGlobalData()
#if PLATFORM(MAC)
delete m_cachedConverterTEC;
#endif
-#if USE(ICU_UNICODE)
+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID)
delete m_cachedConverterICU;
#endif
@@ -94,7 +97,12 @@ ThreadGlobalData::~ThreadGlobalData()
delete m_atomicStringTable;
delete m_threadTimers;
- ASSERT(isMainThread() || m_emptyString->hasOneRef()); // We intentionally don't clean up static data on application quit, so there will be many strings remaining on the main thread.
+ // Using member variable m_isMainThread instead of calling WTF::isMainThread() directly
+ // to avoid issues described in https://bugs.webkit.org/show_bug.cgi?id=25973.
+ // In short, some pthread-based platforms and ports can not use WTF::CurrentThread() and WTF::isMainThread()
+ // in destructors of thread-specific data.
+ ASSERT(m_isMainThread || m_emptyString->hasOneRef()); // We intentionally don't clean up static data on application quit, so there will be many strings remaining on the main thread.
+
delete m_emptyString;
}