diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml')
| -rw-r--r-- | tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml b/tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml index e7dc0243fd..764ed6e6ca 100644 --- a/tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml +++ b/tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml @@ -7,16 +7,14 @@ Item { property bool success: false property bool c1HasBeenDestroyed: false - property Item c1 // not a js reference, so won't keep it alive - SignalEmittedComponent { id: c2 - property int c1a: if (root.c1) root.c1.a; else 0; // will change during onDestruction handler of c1. function c1aChangedHandler() { // this should still be called, after c1 has been destroyed by gc, // because the onDestruction handler of c1 will be triggered prior // to when c1 will be invalidated. - if (root.c1HasBeenDestroyed && c1a == 20) root.c1.setSuccessPropertyOf(root, true); + if (root.c1HasBeenDestroyed) + root.success = true; } } @@ -24,11 +22,10 @@ Item { // dynamically construct sibling. When it goes out of scope, it should be gc'd. // note that the gc() will call weakqobjectcallback which will set queued for // deletion flag -- thus QQmlData::wasDeleted() will return true for that object.. - var c = Qt.createComponent("SignalEmittedComponent.qml", root); - var o = c.createObject(null); // JS ownership - o.onAChanged.connect(c2.c1aChangedHandler); - c1 = o; - c1HasBeenDestroyed = true; + var comp = Qt.createComponent("SignalEmittedComponent.qml", root); + var c1 = comp.createObject(null); // JS ownership + c1.onAChanged.connect(c2.c1aChangedHandler); + c1HasBeenDestroyed = true; // gc will collect c1. // return to event loop. } |
