Merge lp:~thomir-deactivatedaccount/autopilot-qt/always-send-dbus-reply into lp:autopilot-qt

Proposed by Thomi Richards
Status: Merged
Approved by: Michael Zanetti
Approved revision: 40
Merged at revision: 41
Proposed branch: lp:~thomir-deactivatedaccount/autopilot-qt/always-send-dbus-reply
Merge into: lp:autopilot-qt
Diff against target: 126 lines (+47/-38)
1 file modified
driver/dbus_object.cpp (+47/-38)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/autopilot-qt/always-send-dbus-reply
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Christopher Lee (community) Approve
Review via email: mp+153471@code.launchpad.net

Commit message

Autopilot-qt now sends empty dbus replies when a call fails, instead of not sending a reply at all.

Description of the change

Problem:

Sometimes, autopilot-qt fails to find the node specified by autopilot client side. This most often happens when the node is removed, or when xpathsleect fails for some reason. When this happens, autopilot-qt fails to send a dbus reply message, which makes whatever is on the client side hang for the dbus timeout period (10 seconds, I think).

Solution:

This branch makes autopilot-qt send an empty dbus reply straight away. This avoids the timeout on the client-side.

Tested interactively. To reproduce, run autopilot vis against an application running autopilot-qt without this branch - you will see a long delay whenever selecting an object. Running it against autopilot-qt that's built from this branch will remove that delay.

To post a comment you must log in.
Revision history for this message
Christopher Lee (veebers) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'driver/dbus_object.cpp'
2--- driver/dbus_object.cpp 2013-01-17 19:48:27 +0000
3+++ driver/dbus_object.cpp 2013-03-14 21:50:26 +0000
4@@ -66,7 +66,10 @@
5
6 QtNode::Ptr node = GetNodeWithId(object_id);
7 if (! node)
8+ {
9+ qWarning() << "Unable to register signal interest.";
10 return;
11+ }
12
13 QObject* obj = node->getWrappedObject();
14
15@@ -123,68 +126,74 @@
16 void DBusObject::ListSignals(int object_id, const QDBusMessage& message)
17 {
18 QtNode::Ptr node = GetNodeWithId(object_id);
19+ QDBusMessage reply = message.createReply();
20 if (! node)
21- return;
22-
23- QObject *object = node->getWrappedObject();
24- const QMetaObject *meta = object->metaObject();
25- QList<QVariant> signal_list;
26- do
27- {
28- for (int i = meta->methodOffset(); i < meta->methodCount(); ++i)
29+ {
30+ qWarning() << "Unable to list signals.";
31+ }
32+ else
33+ {
34+ QObject *object = node->getWrappedObject();
35+ const QMetaObject *meta = object->metaObject();
36+ QList<QVariant> signal_list;
37+ do
38 {
39- QMetaMethod method = meta->method(i);
40- if (method.methodType() == QMetaMethod::Signal)
41+ for (int i = meta->methodOffset(); i < meta->methodCount(); ++i)
42 {
43+ QMetaMethod method = meta->method(i);
44+ if (method.methodType() == QMetaMethod::Signal)
45+ {
46 #ifdef QT5_SUPPORT
47- QString signature = QString::fromLatin1(method.methodSignature());
48+ QString signature = QString::fromLatin1(method.methodSignature());
49 #else
50- QString signature = QString::fromLatin1(method.signature());
51+ QString signature = QString::fromLatin1(method.signature());
52 #endif
53- signal_list.append(QVariant(signature));
54+ signal_list.append(QVariant(signature));
55+ }
56 }
57- }
58- meta = meta->superClass();
59- } while(meta);
60-
61- QDBusMessage reply = message.createReply();
62- reply << QVariant(signal_list);
63+ meta = meta->superClass();
64+ } while(meta);
65+
66+ reply << QVariant(signal_list);
67+ }
68+
69 QDBusConnection::sessionBus().send(reply);
70 }
71
72 void DBusObject::ListMethods(int object_id, const QDBusMessage &message)
73 {
74+ QDBusMessage reply = message.createReply();
75 QtNode::Ptr node = GetNodeWithId(object_id);
76 if (! node)
77 {
78- qWarning() << "No Object found.";
79- return;
80+ qWarning() << "No Object found while listing methods.";
81 }
82-
83- QObject *object = node->getWrappedObject();
84- const QMetaObject *meta = object->metaObject();
85- QList<QVariant> method_list;
86- do
87+ else
88 {
89- for (int i = meta->methodOffset(); i < meta->methodCount(); ++i)
90+ QObject *object = node->getWrappedObject();
91+ const QMetaObject *meta = object->metaObject();
92+ QList<QVariant> method_list;
93+ do
94 {
95- QMetaMethod method = meta->method(i);
96- if (method.methodType() == QMetaMethod::Slot ||
97- method.methodType() == QMetaMethod::Method)
98+ for (int i = meta->methodOffset(); i < meta->methodCount(); ++i)
99 {
100+ QMetaMethod method = meta->method(i);
101+ if (method.methodType() == QMetaMethod::Slot ||
102+ method.methodType() == QMetaMethod::Method)
103+ {
104 #ifdef QT5_SUPPORT
105- QString signature = QString::fromLatin1(method.methodSignature());
106+ QString signature = QString::fromLatin1(method.methodSignature());
107 #else
108- QString signature = QString::fromLatin1(method.signature());
109+ QString signature = QString::fromLatin1(method.signature());
110 #endif
111- method_list.append(QVariant(signature));
112+ method_list.append(QVariant(signature));
113+ }
114 }
115- }
116- meta = meta->superClass();
117- } while(meta);
118+ meta = meta->superClass();
119+ } while(meta);
120
121- QDBusMessage reply = message.createReply();
122- reply << QVariant(method_list);
123+ reply << QVariant(method_list);
124+ }
125 QDBusConnection::sessionBus().send(reply);
126 }
127

Subscribers

People subscribed via source and target branches

to all changes: