diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2020-11-18 09:59:12 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2020-11-18 17:39:05 +0100 |
commit | 7f74a613f83f35fc5204857868378ed404628e46 (patch) | |
tree | 8b13ace6817f1873227536b677658f1dce0b9608 /src/qml/qml/qqmlproperty.cpp | |
parent | 8b109a322313ec6227392135f0e71f11adc64ea9 (diff) |
tst_qqmlproperty: Fix interfaceBinding crash on MSVC 2019
Change-Id: I4bb4a66b7ccca838e058962bbc297659b273c78e
Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Fixes: QTBUG-84416
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 8ffdf1738c..68127f8686 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -1417,10 +1417,14 @@ bool QQmlPropertyPrivate::write( if (!ok && QQmlMetaType::isInterface(propertyType)) { auto valueAsQObject = qvariant_cast<QObject *>(value); - if (valueAsQObject && valueAsQObject->qt_metacast(QQmlMetaType::interfaceIId(propertyType))) { + + if (void *interface = valueAsQObject + ? valueAsQObject->qt_metacast(QQmlMetaType::interfaceIId(propertyType)) + : nullptr; + interface) { // this case can occur when object has an interface type // and the variant contains a type implementing the interface - return property.writeProperty(object, const_cast<void *>(value.constData()), flags); + return property.writeProperty(object, &interface, flags); } } |