From 52b1993ea43a35983615419d297de903a4188f3e Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 22 Feb 2018 12:14:34 +0100 Subject: Fix issue with bindings to aliases that cannot yet be resolved When an alias points to a child object which has not yet been initialized, it's id won't have been registered yet, so setting up a binding to it will result in a crash. The fix is: when setting a binding target fails, and its target property is an alias, queue them until all bindings have been set up, and try again. Task-number: QTBUG-57041 Change-Id: I4dc5a6d25c0a32fed9fd952c955e2006c76be45a Reviewed-by: Simon Hausmann (cherry picked from commit aa94c6c0469b0595f483f13ac88459f0035deef9) (cherry picked from commit c3db3cfa296dbc5aa198520c1411830d165cd496) --- src/qml/qml/qqmlbinding_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/qml/qml/qqmlbinding_p.h') diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h index 0f2fb329f5..66f8831aef 100644 --- a/src/qml/qml/qqmlbinding_p.h +++ b/src/qml/qml/qqmlbinding_p.h @@ -72,6 +72,8 @@ class Q_QML_PRIVATE_EXPORT QQmlBinding : public QQmlJavaScriptExpression, { friend class QQmlAbstractBinding; public: + typedef QExplicitlySharedDataPointer Ptr; + static QQmlBinding *create(const QQmlPropertyData *, const QQmlScriptString &, QObject *, QQmlContext *); static QQmlBinding *create(const QQmlPropertyData *, const QString &, QObject *, QQmlContextData *, const QString &url = QString(), quint16 lineNumber = 0); @@ -80,7 +82,7 @@ public: ~QQmlBinding(); void setTarget(const QQmlProperty &); - void setTarget(QObject *, const QQmlPropertyData &, const QQmlPropertyData *valueType); + bool setTarget(QObject *, const QQmlPropertyData &, const QQmlPropertyData *valueType); void setNotifyOnValueChanged(bool); -- cgit v1.2.3