summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusinternalfilters.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2015-09-30 23:27:20 +0200
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2015-10-09 07:59:07 +0000
commita3a7d485fa2d572225c7050badf28784316aec37 (patch)
treebed8d082029123d2470bcbb2137d692786cd29a2 /src/dbus/qdbusinternalfilters.cpp
parent3ae1eb623685375468afb8cc71075467d54f12f3 (diff)
Fix crash in QMetaProperty::write for custom types and conversion
if t >= QMetaType::User, we would not return false nor call convert. We would then pass a pointer to whatever is in the QVariant to the qt_metacall that is expecting a pointer to an object of a different type. Since we have custom converters, we can call QVarent::convert even for custom types anyway. [ChangeLog][QtCore] Fixed crash when setting a QVariant of a different type to a property of a custom type. Attempt to do a conversion instead. Task-number: QTBUG-40644 Change-Id: Ib6fbd7e7ddcf25c5ee247ea04177e079f6d7de35 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'src/dbus/qdbusinternalfilters.cpp')
-rw-r--r--src/dbus/qdbusinternalfilters.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index d9e5f7408b..fd6f91e65a 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -366,6 +366,9 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
value = other;
}
+ if (mp.userType() == qMetaTypeId<QDBusVariant>())
+ value = QVariant::fromValue(QDBusVariant(value));
+
// the property type here should match
return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed;
}