Fix JS ownership of children of marked but floating QObjects
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 14 Jun 2013 10:21:45 +0000 (12:21 +0200)
committerLars Knoll <lars.knoll@digia.com>
Sat, 15 Jun 2013 13:23:44 +0000 (15:23 +0200)
commit8833ade28b06f9951a6ae671dfdfcaced98d06b8
tree6b97bb733ca8996117a533509b0edd0a676e7755
parent18ecbd20167b8b5b426134987979eccfa34e92b7
Fix JS ownership of children of marked but floating QObjects

This patch fixes four qqmlecmascript tests: propertyVarImplicitOwnership,
propertyVarReparent, propertyVarReparentNullContext, propertyVarCircular2

Usually QObjects wrapped in JS are kept alive because the GC knows about their
weak values stored in the QQmlData, and so it has to do few steps only to
locate those and mark them.

A slightly less common case is a QObject that's wrapped in JS, without a parent
and is stored in a var or variant property. It's visible to the GC, but the
only strong reference to it is through that var property. So when such an
object gets marked (it's without parent), we also have to mark the child
QObjects's JS wrappers (if existent), all recursively.

Change-Id: Ice347a37a841212c145b6d7a58216e449e5cce08
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/v4/qv4qobjectwrapper.cpp