aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2019-07-04 10:39:43 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2019-07-04 12:29:41 +0200
commit9db3ec26136aa7a7ea58c85c92f5c6288e50e8f5 (patch)
tree042b46fecfbe3087868fc18f3b31386bd8663ea6 /src/qml/types
parent341ab7708049b1a3f559b76f16393e688951a938 (diff)
Fix crash when binding to QML component
As the properties were missing their context, we could not get the correct QMetaObject and would trigger an assertion in canConvert. We now always set the context when creating QQmlProperties in qqmlbind. Fixes: QTBUG-40487 Change-Id: I766c5697dc33fc1e18c2316e28d944975e84ae3c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qqmlbind.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp
index 1ba015f796..5067b6a02e 100644
--- a/src/qml/types/qqmlbind.cpp
+++ b/src/qml/types/qqmlbind.cpp
@@ -241,7 +241,7 @@ void QQmlBind::setObject(QObject *obj)
}
d->obj = obj;
if (d->componentComplete) {
- d->prop = QQmlProperty(d->obj, d->propName);
+ d->prop = QQmlProperty(d->obj, d->propName, qmlContext(this));
d->validate(this);
}
eval();
@@ -287,7 +287,7 @@ void QQmlBind::setProperty(const QString &p)
}
d->propName = p;
if (d->componentComplete) {
- d->prop = QQmlProperty(d->obj, d->propName);
+ d->prop = QQmlProperty(d->obj, d->propName, qmlContext(this));
d->validate(this);
}
eval();
@@ -416,7 +416,7 @@ void QQmlBind::componentComplete()
Q_D(QQmlBind);
d->componentComplete = true;
if (!d->prop.isValid()) {
- d->prop = QQmlProperty(d->obj, d->propName);
+ d->prop = QQmlProperty(d->obj, d->propName, qmlContext(this));
d->validate(this);
}
eval();