Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chris Adams authored and Qt by Nokia committed Dec 23, 2011
1 parent 9e61464 commit 1f4fe0a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/declarative/qml/qdeclarativevmemetaobject.cpp
Expand Up @@ -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);
}
Expand Down
@@ -0,0 +1,5 @@
import QtQuick 2.0

Item {
property var random: null
}
@@ -0,0 +1,8 @@
import QtQuick 2.0

PropertyVarBaseItem {
property bool test: false
Component.onCompleted: {
test = true;
}
}
Expand Up @@ -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()
Expand Down

0 comments on commit 1f4fe0a

Please sign in to comment.