summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2014-06-09 11:57:43 +0200
committerAndy Shaw <andy.shaw@digia.com>2014-06-21 10:39:24 +0200
commit71f6dee8791c95fd862ca3651d7f4b7d6b9f440e (patch)
treeb4ee075ef1fc324bb461b28a2201bb3b253d61a3
parent71a908ab2baaaba24cae183b64c699af3946e042 (diff)
downloadqtscript-71f6dee8791c95fd862ca3651d7f4b7d6b9f440e.tar.gz
Fix crash when creating a QScriptEngine in a native thread
This is technicially a cherry-pick of 4e73732d3e72ea59d39ec5a5c01c2e76bbff7dc1 from 4.8. Somehow this change did not end up in Qt 5. The details below is a copy paste from the original change. 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 Change-Id: If59d7e92998b9f1da98c05b94e7b6c725ada4a75 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecific.h3
1 files changed, 2 insertions, 1 deletions
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<T>::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();