From 1b183c42b5ce74797f12a155c6675e195fe96352 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 18 Dec 2009 08:19:01 +1000 Subject: Use destroy() to destroy binding. --- src/declarative/qml/qmlobjectscriptclass.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- cgit v0.12 From 412920402f488c2cf6eb81e7582f9b5aa7b06680 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 18 Dec 2009 08:34:53 +1000 Subject: Add autotest for d169873541ca6f6725e9ce5bfbbf9941f1823a1f. --- tests/auto/declarative/qmlecmascript/data/CustomObject.qml | 5 +++++ .../declarative/qmlecmascript/data/compositePropertyType.qml | 8 ++++++++ tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 9 +++++++++ 3 files changed, 22 insertions(+) create mode 100644 tests/auto/declarative/qmlecmascript/data/CustomObject.qml create mode 100644 tests/auto/declarative/qmlecmascript/data/compositePropertyType.qml 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(component.create()); + delete object; +} + void tst_qmlecmascript::bug1() { QmlComponent component(&engine, TEST_FILE("bug.1.qml")); -- cgit v0.12