Fix that QJSEngine cannot be used from threads other than the gui thread
authorSimon Hausmann <simon.hausmann@nokia.com>
Tue, 13 Dec 2011 09:04:40 +0000 (10:04 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 15 Dec 2011 11:05:08 +0000 (12:05 +0100)
commita401d0756f6ac3cee5597d5528515061326c3bfa
tree4c5b5ec54d856dc188da54bc8faf0d9de37c9ee7
parent4bb5b4f01c1b38fce9f1a11346de5bd4ee3c6fd4
Fix that QJSEngine cannot be used from threads other than the gui thread

Implicitly allocate & enter an isolate per thread if needed, store it in TLS and
exit it upon thread destruction. As the code that represents QObject
dependencies in the GC through implicit dependencies uses its own context,
its per-thread data is folded into the v8engine TLS to ensure that it is
destructed before the isolate is exited.

Task-number: QTBUG-23099

Change-Id: I86538b54939b2fe64db843052eac04c7fd31813e
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
src/declarative/qml/qdeclarativeworkerscript.cpp
src/declarative/qml/v8/qv8engine.cpp
src/declarative/qml/v8/qv8engine_p.h
tests/auto/declarative/qjsengine/tst_qjsengine.cpp