Prevent object being delete by GC before object is fully created
authorCharles Yin <charles.yin@nokia.com>
Mon, 23 Apr 2012 04:11:31 +0000 (14:11 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 1 May 2012 01:25:01 +0000 (03:25 +0200)
commit78f1d2679242c84efe6d8eb763c13caf58efe19d
tree6e1735eac79f1665b6f76e80e650b43c6000a32d
parent0795351f7c252f1eed97253f64e2d5839ad8a975
Prevent object being delete by GC before object is fully created

Add a new flag inCreation to QQmlData. Set it to true when a top-level object begins creation,
and back to false when initial creation is finished and the object has been marked indestructible.
In the GC callback function, if inCreation is true, skip the GC and make a weak reference for next GC loop.

Change-Id: I4ec82864c52f6be0c3e6ef892474dd77d835e152
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
src/qml/qml/qqmlcomponent.cpp
src/qml/qml/qqmldata_p.h
src/qml/qml/qqmlincubator.cpp
src/qml/qml/qqmlvme.cpp
src/qml/qml/v8/qv8qobjectwrapper.cpp
tests/auto/qml/qqmlecmascript/data/RootObject.qml [new file with mode: 0644]
tests/auto/qml/qqmlecmascript/data/deleteRootObjectInCreation.qml [new file with mode: 0644]
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp