diff options
author | Chris Adams <christopher.adams@nokia.com> | 2011-12-23 13:01:25 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-23 04:20:18 +0100 |
commit | 1f4fe0aca4fc70ece7235623aaf88225531f1243 (patch) | |
tree | 57d86bdefeabc681e8fd235522d7f7d571b6b103 | |
parent | 9e61464c9026c4b766e05ea8c784f8e6a615adba (diff) |
Fix crash in var property setter
Previously, the function didn't terminate after calling the setter
recursively, as it should have. This patch ensures that the setter
is called correctly and then returns, and adds a unit test to ensure
that no regression occurs.
Task-number: QTBUG-23330
Change-Id: If512fca174e5224c2c53caad11f77782e6cead9f
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
4 files changed, 15 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp index a37be927e8..e5e864142a 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject.cpp +++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp @@ -992,6 +992,7 @@ void QDeclarativeVMEMetaObject::setVMEProperty(int index, v8::Handle<v8::Value> if (index < propOffset) { Q_ASSERT(parent); static_cast<QDeclarativeVMEMetaObject *>(parent)->setVMEProperty(index, v); + return; } return writeVarProperty(index - propOffset, v); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/PropertyVarBaseItem.qml b/tests/auto/declarative/qdeclarativeecmascript/data/PropertyVarBaseItem.qml new file mode 100644 index 0000000000..5f28833fe7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/PropertyVarBaseItem.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +Item { + property var random: null +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyVar.10.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyVar.10.qml new file mode 100644 index 0000000000..ac7f2bed57 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyVar.10.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +PropertyVarBaseItem { + property bool test: false + Component.onCompleted: { + test = true; + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 8a028ae039..0e3cfd8970 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -3701,6 +3701,7 @@ void tst_qdeclarativeecmascript::propertyVar_data() QTest::newRow("javascript map assignment") << testFileUrl("propertyVar.7.qml"); QTest::newRow("literal property assignment") << testFileUrl("propertyVar.8.qml"); QTest::newRow("qobject property assignment") << testFileUrl("propertyVar.9.qml"); + QTest::newRow("base class var property assignment") << testFileUrl("propertyVar.10.qml"); } void tst_qdeclarativeecmascript::propertyVar() |