~chasedouglas/kubuntu-packaging/qt-upstream-xi

« back to all changes in this revision

Viewing changes to debian/patches/0280-deserialization-custom-dbus-properties.diff

  • Committer: Jonathan Thomas (The man)
  • Date: 2009-05-06 23:13:20 UTC
  • Revision ID: echidnaman@gmail.com-20090506231320-6bmwyf1shrx4y44a
-Add patches from 1ubuntu4 (it really is 1ubuntu4 now)
-Add .bzr-builddeb from kdebase
-Change Vcs-Browser and Vcs-Bzr in debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
qt-bugs@ issue : N240326
 
2
Qt Software task ID : 240608
 
3
bugs.kde.org number : none
 
4
applied: no
 
5
author: George Goldberg <grundleborg@googlemail.com>
 
6
 
 
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:
 
12
 
 
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.
 
18
 
 
19
Index: src/dbus/qdbusinternalfilters.cpp
 
20
===================================================================
 
21
--- a/src/dbus/qdbusinternalfilters.cpp (revision 960506)
 
22
+++ b/src/dbus/qdbusinternalfilters.cpp (working copy)
 
23
@@ -274,9 +274,23 @@
 
24
             QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
 
25
             it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
 
26
                              interface_name);
 
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();
 
33
+                        void *null = 0;
 
34
+                        QVariant valueStore(mid, null);
 
35
+                        QDBusMetaType::demarshall(valueArg, mid, valueStore.data());
 
36
+
 
37
+                        if (it->adaptor->setProperty(property_name, valueStore))
 
38
+                            return msg.createReply();
 
39
+                    }
 
40
+                }
 
41
+
 
42
                 if (it->adaptor->setProperty(property_name, value))
 
43
                     return msg.createReply();
 
44
+            }
 
45
         }
 
46
     }
 
47