diff options
4 files changed, 25 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 30d4422..4488ba1 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -302,7 +302,9 @@ void QmlObjectScriptClass::setProperty(QObject *obj, // ### Can well known types be optimized? QVariant v = QmlScriptClass::toVariant(engine, value); - delete QmlMetaPropertyPrivate::setBinding(obj, *lastData, 0); + QmlAbstractBinding *delBinding = QmlMetaPropertyPrivate::setBinding(obj, *lastData, 0); + if (delBinding) + delBinding->destroy(); QmlMetaPropertyPrivate::write(obj, *lastData, v, evalContext); } diff --git a/tests/auto/declarative/qmlecmascript/data/CustomObject.qml b/tests/auto/declarative/qmlecmascript/data/CustomObject.qml new file mode 100644 index 0000000..691d9ec --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/CustomObject.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +QtObject { + property string greeting: "hello world" +} diff --git a/tests/auto/declarative/qmlecmascript/data/compositePropertyType.qml b/tests/auto/declarative/qmlecmascript/data/compositePropertyType.qml new file mode 100644 index 0000000..80a2814 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/compositePropertyType.qml @@ -0,0 +1,8 @@ +import Qt 4.6 + +QtObject { + property CustomObject myObject + myObject: CustomObject { } + + Component.onCompleted: console.log(myObject.greeting) +} diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index b9a2241..f0e54ef 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -110,6 +110,7 @@ private slots: void transientErrors(); void shutdownErrors(); void externalScript(); + void compositePropertyType(); void bug1(); @@ -1017,6 +1018,14 @@ void tst_qmlecmascript::externalScript() } } +void tst_qmlecmascript::compositePropertyType() +{ + QmlComponent component(&engine, TEST_FILE("compositePropertyType.qml")); + QTest::ignoreMessage(QtDebugMsg, "hello world"); + QObject *object = qobject_cast<QObject *>(component.create()); + delete object; +} + void tst_qmlecmascript::bug1() { QmlComponent component(&engine, TEST_FILE("bug.1.qml")); |