Fix crashes caused by handle management in worker threads
Previously, the QV8Engine destructor and the QV8Engine's QV8GCCallback
Referencer destructor would crash if run after the v8 isolate had been
exited and disposed. This commit Q_ASSERTs if the worker thread
attempts to do so, and adds a cleanup function which worker threads
should call just prior to exiting the isolate.
Task-number: QTBUG-21866
Change-Id: I379b02e24ad9378e4bfc270fb9208715b6f7b60a
Reviewed-on: http://codereview.qt-project.org/6202
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>