diff options
author | Chris Adams <christopher.adams@nokia.com> | 2012-01-27 11:33:37 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-15 00:22:45 +0100 |
commit | b06108350b1390b51886474628e03e2e84640548 (patch) | |
tree | bbf00677d9edc64e2549f2cc3ee42f1edd5a50f4 /tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml | |
parent | a27fd584df0ec3d1d072501d8fefe576a97a2e53 (diff) |
Ensure that dynamic property storing QObject ptr notifies on delete
Previously, when a QObject ptr was stored in a dynamic variant
property, the value of the property could change (to a zero ptr)
if the QObject was deleted without a notify signal being emitted
by the QDeclarativeVMEMetaObject which stores the property.
This commit ensures that such a notify signal is emitted correctly.
Task-number: QTBUG-23451
Change-Id: I5689abd984b177737f8d5f18950838b73ebde328
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml new file mode 100644 index 0000000000..3739150bc4 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml @@ -0,0 +1,30 @@ +import QtQuick 2.0 +import Qt.test 1.0 + +Item { + id: root + property bool test: false + property QtObject objectProperty + + onObjectPropertyChanged: { + root.test = true; + } + + property Component c: Component { + id: dynamicComponent + QtObject { + id: dynamicObject + } + } + + function create() { + root.objectProperty = root.c.createObject(root); + } + + function destroy() { + root.test = false; // reset test + root.objectProperty.destroy(100); + // in cpp, wait objectProperty deletion, inspect "test" and "objectProperty" + // test should be true and value of objectProperty should be zero. + } +} |