summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-07-26 13:40:10 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-07-26 14:05:15 (GMT)
commit2ecb7eebdc950eb559b9203d70077301b8b5a3b1 (patch)
treede1bfc9cbf20849be52b7ed48cb4cf461f6c647a /src/declarative
parenta882a46b1c60e5774ade68eaac60922b19a08835 (diff)
downloadQt-2ecb7eebdc950eb559b9203d70077301b8b5a3b1.zip
Qt-2ecb7eebdc950eb559b9203d70077301b8b5a3b1.tar.gz
Qt-2ecb7eebdc950eb559b9203d70077301b8b5a3b1.tar.bz2
QDeclarativeEngineDebugServer: Fix crash when trying to update non-properties.
QDeclarativePropertyPrivate::setBinding would delete the binding if it cannot set the property. Then the call to binding->update() would crash. So test for (property.isProperty()) before. Also this will display a warning in the application output if the property cannot be changed. Reviewed-by: Lasse Holmstedt
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 008d054..1837366 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -485,24 +485,22 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId,
if (object && context) {
+ QDeclarativeProperty property(object, propertyName, context);
if (isLiteralValue) {
- QDeclarativeProperty literalProperty(object, propertyName, context);
- literalProperty.write(expression);
+ property.write(expression);
+ } else if (hasValidSignal(object, propertyName)) {
+ QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString());
+ QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression);
+ } else if (property.isProperty()) {
+ QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context);
+ binding->setTarget(property);
+ binding->setNotifyOnValueChanged(true);
+ QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, binding);
+ if (oldBinding)
+ oldBinding->destroy();
+ binding->update();
} else {
- if (hasValidSignal(object, propertyName)) {
- QDeclarativeProperty property(object, propertyName);
- QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString());
- QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression);
- } else {
- QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context);
- QDeclarativeProperty property(object, propertyName, context);
- binding->setTarget(property);
- binding->setNotifyOnValueChanged(true);
- QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, binding);
- if (oldBinding)
- oldBinding->destroy();
- binding->update();
- }
+ qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object;
}
}
}