diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.2.qml')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.2.qml | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.2.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.2.qml new file mode 100644 index 0000000000..9f1f67bbeb --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.2.qml @@ -0,0 +1,33 @@ +import Qt.test 1.0 +import QtQuick 2.0 +import "scriptConnect.6.js" as Script + +Item { + id: root + + property int test: 0 + property var dynamicObjectProperty: undefined + + signal outer + Component { + id: comp + Item { + signal inner + onInner: { Script.testFunction(); root.disconnectAndDestroyDynamicObject(); } + } + } + + function disconnectAndDestroyDynamicObject() { + if (dynamicObjectProperty) { + root.outer.disconnect(dynamicObjectProperty.inner); + dynamicObjectProperty.destroy(); + dynamicObjectProperty = undefined; + gc(); + } + } + + Component.onCompleted: { + dynamicObjectProperty = comp.createObject(root); + root.outer.connect(dynamicObjectProperty.inner); + } +} |