diff options
author | Charles Yin <charles.yin@nokia.com> | 2012-04-23 14:11:31 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-01 03:25:01 +0200 |
commit | 78f1d2679242c84efe6d8eb763c13caf58efe19d (patch) | |
tree | 6e1735eac79f1665b6f76e80e650b43c6000a32d /src/qml/qml/qqmlcomponent.cpp | |
parent | 0795351f7c252f1eed97253f64e2d5839ad8a975 (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/qqmlcomponent.cpp')
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 2e46192246..e5c498a662 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -836,6 +836,7 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context) //if JS ownership is needed this needs to be explicitly undone (like in component.createObject()) ddata->indestructible = true; ddata->explicitIndestructibleSet = true; + ddata->inCreation = false; } if (enginePriv->isDebugging && rv) { |