aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-05-15 12:15:35 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-16 05:53:49 +0200
commitea13e0cf3faa3d397deb54a3f213e6a627745f0f (patch)
tree6ef1fc443a8505885d9392859d6cd40ff4bb4709 /tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml
parent14e247e4b94df17ed62750b4468c2ac25aabe30f (diff)
Ensure that we don't attempt to dispose handle twice
If a weak ref callback causes disposal of a v8object associated with a qobject, the later qqmldata::destroyed() handler could cause a double dispose, due to 753d9f4be5960be8b11ad067b29fc87c168ee663. Change-Id: I07c1c8e2e7b444a7e873da26bc4d0c19bcfe57b5 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml b/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml
new file mode 100644
index 0000000000..ce542d3dbd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import Qt.test.qobjectApi 1.0 as ModApi
+
+Rectangle {
+ id: base
+ color: "red"
+
+ function flipOwnership() {
+ ModApi.trackObject(base);
+ ModApi.trackedObject(); // flip the ownership.
+ if (!ModApi.trackedObjectHasJsOwnership())
+ derived.testConditionsMet = false;
+ else
+ derived.testConditionsMet = true;
+ }
+
+ onColorChanged: {
+ // will be triggered during beginCreate of derived
+ flipOwnership();
+ gc();
+ gc();
+ gc();
+ }
+}