aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmldata_p.h
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-04-23 14:11:31 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-01 03:25:01 +0200
commit78f1d2679242c84efe6d8eb763c13caf58efe19d (patch)
tree6e1735eac79f1665b6f76e80e650b43c6000a32d /src/qml/qml/qqmldata_p.h
parent0795351f7c252f1eed97253f64e2d5839ad8a975 (diff)
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>
Diffstat (limited to 'src/qml/qml/qqmldata_p.h')
-rw-r--r--src/qml/qml/qqmldata_p.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index 1a188f9e59..ffaa7e2cb5 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -79,7 +79,7 @@ class Q_QML_EXPORT QQmlData : public QAbstractDeclarativeData
public:
QQmlData()
: ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
- hasTaintedV8Object(false), isQueuedForDeletion(false), notifyList(0), context(0), outerContext(0),
+ hasTaintedV8Object(false), isQueuedForDeletion(false), inCreation(false), notifyList(0), context(0), outerContext(0),
bindings(0), signalHandlers(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0),
lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), v8objectid(0),
propertyCache(0), guards(0), extendedData(0) {
@@ -114,7 +114,12 @@ public:
quint32 explicitIndestructibleSet:1;
quint32 hasTaintedV8Object:1;
quint32 isQueuedForDeletion:1;
- quint32 dummy:26;
+ /*
+ * inCreation should be true only when creating top level CPP and QML objects,
+ * v8 GC will check this flag, only deletes the objects when inCreation is false.
+ */
+ quint32 inCreation:1;
+ quint32 dummy:25;
struct NotifyList {
quint64 connectionMask;