Only free context if the owning QV8ContextResource gets destroyed
authorPhilip Lorenz <philip@bithub.de>
Sat, 1 Dec 2012 11:58:39 +0000 (12:58 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 10 Dec 2012 17:09:27 +0000 (18:09 +0100)
commitc18e04b2e61f174a4883f6884cf9a0712c5725e3
tree1be41c4bd81b01519b0cf3d54fcbd17a10842fc7
parent22924ac4fe1962022ec12f40c66bf5cb988515b3
Only free context if the owning QV8ContextResource gets destroyed

Since fdeee38b781376012c4f086276c3c376726c8839 QQmlXMLHttpRequest stores
the calling context for later use. This leads to issues after the first
request completes and the wrapping QV8ContextResource gets freed by
garbage collection and therefore removes the associated QQmlDataContext
which may still be required for later calls (e.g. if the calling context
is part of a stateless library).

This patch introduces an ownership flag for QV8ContextResource which
indicates if the associated context should be cleared when the object is
destroyed.

Task-number: QTBUG-28351

Change-Id: I552ebb5c55b889eb33f3884283c8fdf037ac33be
Reviewed-by: Alan Alpert <aalpert@rim.com>
src/qml/qml/qqmlvme.cpp
src/qml/qml/v8/qv8contextwrapper.cpp
src/qml/qml/v8/qv8contextwrapper_p.h
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp