1
qt-bugs@ issue : N240326
2
Qt Software task ID : 240608
3
bugs.kde.org number : none
5
author: George Goldberg <grundleborg@googlemail.com>
7
This patch fixes deserialization of values with custom types when setting
8
properties on dbus adaptors. It is needed, in particular by telepathy/Qt
9
programs and libraries. The bug was reported to Nokia on 2009-01-07 along
10
with the patch supplied here. The summary of the issue from the Qt
11
Software task tracker follows:
13
When calling the setter for a DBus property, if that property has a custom type
14
(e.g. a struct with dbus type (uss)), QtDBus fails to demarshall the
15
QDBusArgument before attempting to set the property on the adaptor. The result
16
is that it attempts to call adaptor->setProperty() with a QDBusArgument of type
17
"uss" instead of with the type of the custom struct.
19
Index: src/dbus/qdbusinternalfilters.cpp
20
===================================================================
21
--- a/src/dbus/qdbusinternalfilters.cpp (revision 960506)
22
+++ b/src/dbus/qdbusinternalfilters.cpp (working copy)
24
QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
25
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
27
- if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface))
28
+ if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) {
29
+ if (value.userType() == qMetaTypeId<QDBusArgument>()) {
30
+ QDBusArgument valueArg = qvariant_cast<QDBusArgument>(value);
31
+ if (valueArg.currentType() != -1) {
32
+ int mid = it->adaptor->metaObject()->property(it->adaptor->metaObject()->indexOfProperty(property_name)).userType();
34
+ QVariant valueStore(mid, null);
35
+ QDBusMetaType::demarshall(valueArg, mid, valueStore.data());
37
+ if (it->adaptor->setProperty(property_name, valueStore))
38
+ return msg.createReply();
42
if (it->adaptor->setProperty(property_name, value))
43
return msg.createReply();