aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-06-13 16:49:34 +0200
committerLars Knoll <lars.knoll@digia.com>2013-06-13 17:50:39 +0200
commit80aa1e04517882ee42747a2a5f6a727e1128d691 (patch)
treee7ddb991562caf290542981d07fda629d3cbb369 /tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml
parente93d3a57f07f7f2cdb8f2fb42c30d731e0097c91 (diff)
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 <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml11
1 files 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 1143eaf919..c2325fb5ee 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.