From 4e73732d3e72ea59d39ec5a5c01c2e76bbff7dc1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 5 Jan 2012 11:47:52 +0100 Subject: Fix crash when creating a QScriptEngine in a native thread The change in http://trac.webkit.org/changeset/48412/ introduced a fix to avoid leaking thread specific data by ensuring get() on ThreadSpecific works even during the thread destruction phase. The fix worked by setting the local data again. However as we can see in the backtrace from QTBUG-22926, the local data should not be set unconditionally, otherwise our destroy function will be called recursively when the local data is still set. Task-number: QTBUG-22926 Reviewed-by: Kent Hansen Tested-and-Reviewed-by: Andy Shaw --- src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecific.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecific.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecific.h index 7e5679f..3f0e764 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecific.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecific.h @@ -256,7 +256,8 @@ inline void ThreadSpecific::destroy(void* ptr) #endif #if PLATFORM(QT) // See comment as above - data->owner->m_key.setLocalData(data); + if (!data->owner->m_key.hasLocalData()) + data->owner->m_key.setLocalData(data); #endif data->value->~T(); -- cgit v0.12