From 80aa1e04517882ee42747a2a5f6a727e1128d691 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 13 Jun 2013 16:49:34 +0200 Subject: [PATCH] Fix qqmlecmascript::propertyVarOwnership Don't rely on o = new Date in the test-case to really clear the last "reference" on the stack. As it turns out, in v4, we sometimes allocate the result of "new Date" in a different slot and the old slot is still around (and thus the object is visible and marked). Instead work with separate scopes, which requires a little helper function in JS. Change-Id: I5f318feaccfc7d83dbe28be043a0ee83e0c16355 Reviewed-by: Lars Knoll --- tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml index 1143eaf..c2325fb 100644 --- a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml +++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml @@ -5,7 +5,8 @@ Item { id: testOwnership property bool test: false - function runTest() { + function createComponent() + { var o; var c = Qt.createComponent("ComponentWithVarProp.qml"); if (c.status == Component.Ready) { @@ -15,8 +16,12 @@ Item { } o.varprop = true; // causes initialization of varProperties. SingletonType.QObject.trackObject(o); // stores QObject ptr - if (SingletonType.QObject.trackedObject() == null) return; // is still valid, should have a valid v8object. - o = new Date(); // causes object to be gc-able. + if (SingletonType.QObject.trackedObject() == null) return false // is still valid, should have a valid v8object. + return true; + } + + function runTest() { + if (!createComponent()) return; gc(); // collect object's v8object + varProperties, queues deleteLater. if (SingletonType.QObject.trackedObject() != null) return; // v8object was previously collected. SingletonType.QObject.setTrackedObjectProperty("varprop"); // deferences varProperties of object. -- 2.7.4