Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtDBus module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qdbusintegrator_p.h" | - |
43 | | - |
44 | #include <qcoreapplication.h> | - |
45 | #include <qdebug.h> | - |
46 | #include <qmetaobject.h> | - |
47 | #include <qobject.h> | - |
48 | #include <qsocketnotifier.h> | - |
49 | #include <qstringlist.h> | - |
50 | #include <qtimer.h> | - |
51 | #include <qthread.h> | - |
52 | | - |
53 | #include "qdbusargument.h" | - |
54 | #include "qdbusconnection_p.h" | - |
55 | #include "qdbusconnectionmanager_p.h" | - |
56 | #include "qdbusinterface_p.h" | - |
57 | #include "qdbusmessage.h" | - |
58 | #include "qdbusmetatype.h" | - |
59 | #include "qdbusmetatype_p.h" | - |
60 | #include "qdbusabstractadaptor.h" | - |
61 | #include "qdbusabstractadaptor_p.h" | - |
62 | #include "qdbusutil_p.h" | - |
63 | #include "qdbusvirtualobject.h" | - |
64 | #include "qdbusmessage_p.h" | - |
65 | #include "qdbuscontext_p.h" | - |
66 | #include "qdbuspendingcall_p.h" | - |
67 | | - |
68 | #include "qdbusthreaddebug_p.h" | - |
69 | | - |
70 | #include <algorithm> | - |
71 | | - |
72 | #ifndef QT_NO_DBUS | - |
73 | | - |
74 | QT_BEGIN_NAMESPACE | - |
75 | | - |
76 | static bool isDebugging; | - |
77 | #define qDBusDebug if (!::isDebugging); else qDebug | - |
78 | | - |
79 | Q_GLOBAL_STATIC_WITH_ARGS(const QString, orgFreedesktopDBusString, (QLatin1String(DBUS_SERVICE_DBUS))) never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:405 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:13 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:13 | yes Evaluation Count:392 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-405 |
80 | | - |
81 | static inline QString dbusServiceString() | - |
82 | { return *orgFreedesktopDBusString(); } executed: return *orgFreedesktopDBusString(); Execution Count:392 | 392 |
83 | static inline QString dbusInterfaceString() | - |
84 | { | - |
85 | // it's the same string, but just be sure | - |
86 | Q_ASSERT(*orgFreedesktopDBusString() == QLatin1String(DBUS_INTERFACE_DBUS)); executed (the execution status of this line is deduced): qt_noop(); | - |
87 | return *orgFreedesktopDBusString(); executed: return *orgFreedesktopDBusString(); Execution Count:13 | 13 |
88 | } | - |
89 | | - |
90 | static inline QDebug operator<<(QDebug dbg, const QThread *th) | - |
91 | { | - |
92 | dbg.nospace() << "QThread(ptr=" << (void*)th; never executed (the execution status of this line is deduced): dbg.nospace() << "QThread(ptr=" << (void*)th; | - |
93 | if (th && !th->objectName().isEmpty()) never evaluated: th never evaluated: !th->objectName().isEmpty() | 0 |
94 | dbg.nospace() << ", name=" << th->objectName(); never executed: dbg.nospace() << ", name=" << th->objectName(); | 0 |
95 | dbg.nospace() << ')'; never executed (the execution status of this line is deduced): dbg.nospace() << ')'; | - |
96 | return dbg.space(); never executed: return dbg.space(); | 0 |
97 | } | - |
98 | | - |
99 | #if QDBUS_THREAD_DEBUG | - |
100 | static inline QDebug operator<<(QDebug dbg, const QDBusConnectionPrivate *conn) | - |
101 | { | - |
102 | dbg.nospace() << "QDBusConnection(" | - |
103 | << "ptr=" << (void*)conn | - |
104 | << ", name=" << conn->name | - |
105 | << ", baseService=" << conn->baseService | - |
106 | << ", thread="; | - |
107 | if (conn->thread() == QThread::currentThread()) | - |
108 | dbg.nospace() << "same thread"; | - |
109 | else | - |
110 | dbg.nospace() << conn->thread(); | - |
111 | dbg.nospace() << ')'; | - |
112 | return dbg.space(); | - |
113 | } | - |
114 | | - |
115 | void qdbusDefaultThreadDebug(int action, int condition, QDBusConnectionPrivate *conn) | - |
116 | { | - |
117 | qDBusDebug() << QThread::currentThread() | - |
118 | << "Qt D-Bus threading action" << action | - |
119 | << (condition == QDBusLockerBase::BeforeLock ? "before lock" : | - |
120 | condition == QDBusLockerBase::AfterLock ? "after lock" : | - |
121 | condition == QDBusLockerBase::BeforeUnlock ? "before unlock" : | - |
122 | condition == QDBusLockerBase::AfterUnlock ? "after unlock" : | - |
123 | condition == QDBusLockerBase::BeforePost ? "before event posting" : | - |
124 | condition == QDBusLockerBase::AfterPost ? "after event posting" : | - |
125 | condition == QDBusLockerBase::BeforeDeliver ? "before event delivery" : | - |
126 | condition == QDBusLockerBase::AfterDeliver ? "after event delivery" : | - |
127 | condition == QDBusLockerBase::BeforeAcquire ? "before acquire" : | - |
128 | condition == QDBusLockerBase::AfterAcquire ? "after acquire" : | - |
129 | condition == QDBusLockerBase::BeforeRelease ? "before release" : | - |
130 | condition == QDBusLockerBase::AfterRelease ? "after release" : | - |
131 | "condition unknown") | - |
132 | << "in connection" << conn; | - |
133 | } | - |
134 | qdbusThreadDebugFunc qdbusThreadDebug = 0; | - |
135 | #endif | - |
136 | | - |
137 | typedef void (*QDBusSpyHook)(const QDBusMessage&); | - |
138 | typedef QVarLengthArray<QDBusSpyHook, 4> QDBusSpyHookList; | - |
139 | Q_GLOBAL_STATIC(QDBusSpyHookList, qDBusSpyHookList) never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:639 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:11 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:11 | yes Evaluation Count:628 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-639 |
140 | | - |
141 | extern "C" { | - |
142 | | - |
143 | // libdbus-1 callbacks | - |
144 | | - |
145 | static bool qDBusRealAddTimeout(QDBusConnectionPrivate *d, DBusTimeout *timeout, int ms); | - |
146 | static dbus_bool_t qDBusAddTimeout(DBusTimeout *timeout, void *data) | - |
147 | { | - |
148 | Q_ASSERT(timeout); executed (the execution status of this line is deduced): qt_noop(); | - |
149 | Q_ASSERT(data); executed (the execution status of this line is deduced): qt_noop(); | - |
150 | | - |
151 | // qDebug("addTimeout %d", q_dbus_timeout_get_interval(timeout)); | - |
152 | | - |
153 | QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); executed (the execution status of this line is deduced): QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); | - |
154 | | - |
155 | if (!q_dbus_timeout_get_enabled(timeout)) partially evaluated: !q_dbus_timeout_get_enabled(timeout) no Evaluation Count:0 | yes Evaluation Count:1350 |
| 0-1350 |
156 | return true; never executed: return true; | 0 |
157 | | - |
158 | QDBusWatchAndTimeoutLocker locker(AddTimeoutAction, d); executed (the execution status of this line is deduced): QDBusWatchAndTimeoutLocker locker(AddTimeoutAction, d); | - |
159 | if (QCoreApplication::instance() && QThread::currentThread() == d->thread()) { partially evaluated: QCoreApplication::instance() yes Evaluation Count:1350 | no Evaluation Count:0 |
evaluated: QThread::currentThread() == d->thread() yes Evaluation Count:1344 | yes Evaluation Count:6 |
| 0-1350 |
160 | // correct thread | - |
161 | return qDBusRealAddTimeout(d, timeout, q_dbus_timeout_get_interval(timeout)); executed: return qDBusRealAddTimeout(d, timeout, q_dbus_timeout_get_interval(timeout)); Execution Count:1344 | 1344 |
162 | } else { | - |
163 | // wrong thread: sync back | - |
164 | QDBusConnectionCallbackEvent *ev = new QDBusConnectionCallbackEvent; executed (the execution status of this line is deduced): QDBusConnectionCallbackEvent *ev = new QDBusConnectionCallbackEvent; | - |
165 | ev->subtype = QDBusConnectionCallbackEvent::AddTimeout; executed (the execution status of this line is deduced): ev->subtype = QDBusConnectionCallbackEvent::AddTimeout; | - |
166 | d->timeoutsPendingAdd.append(qMakePair(timeout, q_dbus_timeout_get_interval(timeout))); executed (the execution status of this line is deduced): d->timeoutsPendingAdd.append(qMakePair(timeout, q_dbus_timeout_get_interval(timeout))); | - |
167 | d->postEventToThread(AddTimeoutAction, d, ev); executed (the execution status of this line is deduced): d->postEventToThread(AddTimeoutAction, d, ev); | - |
168 | return true; executed: return true; Execution Count:6 | 6 |
169 | } | - |
170 | } | - |
171 | | - |
172 | static bool qDBusRealAddTimeout(QDBusConnectionPrivate *d, DBusTimeout *timeout, int ms) | - |
173 | { | - |
174 | Q_ASSERT(d->timeouts.keys(timeout).isEmpty()); executed (the execution status of this line is deduced): qt_noop(); | - |
175 | | - |
176 | int timerId = d->startTimer(ms); executed (the execution status of this line is deduced): int timerId = d->startTimer(ms); | - |
177 | if (!timerId) partially evaluated: !timerId no Evaluation Count:0 | yes Evaluation Count:1348 |
| 0-1348 |
178 | return false; never executed: return false; | 0 |
179 | | - |
180 | d->timeouts[timerId] = timeout; executed (the execution status of this line is deduced): d->timeouts[timerId] = timeout; | - |
181 | return true; executed: return true; Execution Count:1348 | 1348 |
182 | } | - |
183 | | - |
184 | static void qDBusRemoveTimeout(DBusTimeout *timeout, void *data) | - |
185 | { | - |
186 | Q_ASSERT(timeout); executed (the execution status of this line is deduced): qt_noop(); | - |
187 | Q_ASSERT(data); executed (the execution status of this line is deduced): qt_noop(); | - |
188 | | - |
189 | // qDebug("removeTimeout"); | - |
190 | | - |
191 | QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); executed (the execution status of this line is deduced): QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); | - |
192 | | - |
193 | QDBusWatchAndTimeoutLocker locker(RemoveTimeoutAction, d); executed (the execution status of this line is deduced): QDBusWatchAndTimeoutLocker locker(RemoveTimeoutAction, d); | - |
194 | | - |
195 | // is it pending addition? | - |
196 | QDBusConnectionPrivate::PendingTimeoutList::iterator pit = d->timeoutsPendingAdd.begin(); executed (the execution status of this line is deduced): QDBusConnectionPrivate::PendingTimeoutList::iterator pit = d->timeoutsPendingAdd.begin(); | - |
197 | while (pit != d->timeoutsPendingAdd.end()) { evaluated: pit != d->timeoutsPendingAdd.end() yes Evaluation Count:2 | yes Evaluation Count:1350 |
| 2-1350 |
198 | if (pit->first == timeout) partially evaluated: pit->first == timeout yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
199 | pit = d->timeoutsPendingAdd.erase(pit); executed: pit = d->timeoutsPendingAdd.erase(pit); Execution Count:2 | 2 |
200 | else | - |
201 | ++pit; | 0 |
202 | } | - |
203 | | - |
204 | // is it a running timer? | - |
205 | bool correctThread = QCoreApplication::instance() && QThread::currentThread() == d->thread(); partially evaluated: QCoreApplication::instance() yes Evaluation Count:1350 | no Evaluation Count:0 |
evaluated: QThread::currentThread() == d->thread() yes Evaluation Count:1348 | yes Evaluation Count:2 |
| 0-1350 |
206 | QDBusConnectionPrivate::TimeoutHash::iterator it = d->timeouts.begin(); executed (the execution status of this line is deduced): QDBusConnectionPrivate::TimeoutHash::iterator it = d->timeouts.begin(); | - |
207 | while (it != d->timeouts.end()) { evaluated: it != d->timeouts.end() yes Evaluation Count:1348 | yes Evaluation Count:2 |
| 2-1348 |
208 | if (it.value() == timeout) { partially evaluated: it.value() == timeout yes Evaluation Count:1348 | no Evaluation Count:0 |
| 0-1348 |
209 | if (correctThread) { partially evaluated: correctThread yes Evaluation Count:1348 | no Evaluation Count:0 |
| 0-1348 |
210 | // correct thread | - |
211 | d->killTimer(it.key()); executed (the execution status of this line is deduced): d->killTimer(it.key()); | - |
212 | } else { executed: } Execution Count:1348 | 1348 |
213 | // incorrect thread or no application, post an event for later | - |
214 | QDBusConnectionCallbackEvent *ev = new QDBusConnectionCallbackEvent; never executed (the execution status of this line is deduced): QDBusConnectionCallbackEvent *ev = new QDBusConnectionCallbackEvent; | - |
215 | ev->subtype = QDBusConnectionCallbackEvent::KillTimer; never executed (the execution status of this line is deduced): ev->subtype = QDBusConnectionCallbackEvent::KillTimer; | - |
216 | ev->timerId = it.key(); never executed (the execution status of this line is deduced): ev->timerId = it.key(); | - |
217 | d->postEventToThread(KillTimerAction, d, ev); never executed (the execution status of this line is deduced): d->postEventToThread(KillTimerAction, d, ev); | - |
218 | } | 0 |
219 | it = d->timeouts.erase(it); executed (the execution status of this line is deduced): it = d->timeouts.erase(it); | - |
220 | break; executed: break; Execution Count:1348 | 1348 |
221 | } else { | - |
222 | ++it; never executed (the execution status of this line is deduced): ++it; | - |
223 | } | 0 |
224 | } | - |
225 | } executed: } Execution Count:1350 | 1350 |
226 | | - |
227 | static void qDBusToggleTimeout(DBusTimeout *timeout, void *data) | - |
228 | { | - |
229 | Q_ASSERT(timeout); never executed (the execution status of this line is deduced): qt_noop(); | - |
230 | Q_ASSERT(data); never executed (the execution status of this line is deduced): qt_noop(); | - |
231 | | - |
232 | //qDebug("ToggleTimeout"); | - |
233 | | - |
234 | qDBusRemoveTimeout(timeout, data); never executed (the execution status of this line is deduced): qDBusRemoveTimeout(timeout, data); | - |
235 | qDBusAddTimeout(timeout, data); never executed (the execution status of this line is deduced): qDBusAddTimeout(timeout, data); | - |
236 | } | 0 |
237 | | - |
238 | static bool qDBusRealAddWatch(QDBusConnectionPrivate *d, DBusWatch *watch, int flags, int fd); | - |
239 | static dbus_bool_t qDBusAddWatch(DBusWatch *watch, void *data) | - |
240 | { | - |
241 | Q_ASSERT(watch); executed (the execution status of this line is deduced): qt_noop(); | - |
242 | Q_ASSERT(data); executed (the execution status of this line is deduced): qt_noop(); | - |
243 | | - |
244 | QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); executed (the execution status of this line is deduced): QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); | - |
245 | | - |
246 | int flags = q_dbus_watch_get_flags(watch); executed (the execution status of this line is deduced): int flags = q_dbus_watch_get_flags(watch); | - |
247 | int fd = q_dbus_watch_get_fd(watch); executed (the execution status of this line is deduced): int fd = q_dbus_watch_get_fd(watch); | - |
248 | | - |
249 | if (QCoreApplication::instance() && QThread::currentThread() == d->thread()) { partially evaluated: QCoreApplication::instance() yes Evaluation Count:338 | no Evaluation Count:0 |
partially evaluated: QThread::currentThread() == d->thread() yes Evaluation Count:338 | no Evaluation Count:0 |
| 0-338 |
250 | return qDBusRealAddWatch(d, watch, flags, fd); executed: return qDBusRealAddWatch(d, watch, flags, fd); Execution Count:338 | 338 |
251 | } else { | - |
252 | QDBusConnectionCallbackEvent *ev = new QDBusConnectionCallbackEvent; never executed (the execution status of this line is deduced): QDBusConnectionCallbackEvent *ev = new QDBusConnectionCallbackEvent; | - |
253 | ev->subtype = QDBusConnectionCallbackEvent::AddWatch; never executed (the execution status of this line is deduced): ev->subtype = QDBusConnectionCallbackEvent::AddWatch; | - |
254 | ev->watch = watch; never executed (the execution status of this line is deduced): ev->watch = watch; | - |
255 | ev->fd = fd; never executed (the execution status of this line is deduced): ev->fd = fd; | - |
256 | ev->extra = flags; never executed (the execution status of this line is deduced): ev->extra = flags; | - |
257 | d->postEventToThread(AddWatchAction, d, ev); never executed (the execution status of this line is deduced): d->postEventToThread(AddWatchAction, d, ev); | - |
258 | return true; never executed: return true; | 0 |
259 | } | - |
260 | } | - |
261 | | - |
262 | static bool qDBusRealAddWatch(QDBusConnectionPrivate *d, DBusWatch *watch, int flags, int fd) | - |
263 | { | - |
264 | QDBusConnectionPrivate::Watcher watcher; executed (the execution status of this line is deduced): QDBusConnectionPrivate::Watcher watcher; | - |
265 | | - |
266 | QDBusWatchAndTimeoutLocker locker(AddWatchAction, d); executed (the execution status of this line is deduced): QDBusWatchAndTimeoutLocker locker(AddWatchAction, d); | - |
267 | if (flags & DBUS_WATCH_READABLE) { evaluated: flags & DBUS_WATCH_READABLE yes Evaluation Count:173 | yes Evaluation Count:165 |
| 165-173 |
268 | //qDebug("addReadWatch %d", fd); | - |
269 | watcher.watch = watch; executed (the execution status of this line is deduced): watcher.watch = watch; | - |
270 | if (QCoreApplication::instance()) { partially evaluated: QCoreApplication::instance() yes Evaluation Count:173 | no Evaluation Count:0 |
| 0-173 |
271 | watcher.read = new QSocketNotifier(fd, QSocketNotifier::Read, d); executed (the execution status of this line is deduced): watcher.read = new QSocketNotifier(fd, QSocketNotifier::Read, d); | - |
272 | watcher.read->setEnabled(q_dbus_watch_get_enabled(watch)); executed (the execution status of this line is deduced): watcher.read->setEnabled(q_dbus_watch_get_enabled(watch)); | - |
273 | d->connect(watcher.read, SIGNAL(activated(int)), SLOT(socketRead(int))); executed (the execution status of this line is deduced): d->connect(watcher.read, "2""activated(int)", "1""socketRead(int)"); | - |
274 | } executed: } Execution Count:173 | 173 |
275 | } executed: } Execution Count:173 | 173 |
276 | if (flags & DBUS_WATCH_WRITABLE) { evaluated: flags & DBUS_WATCH_WRITABLE yes Evaluation Count:165 | yes Evaluation Count:173 |
| 165-173 |
277 | //qDebug("addWriteWatch %d", fd); | - |
278 | watcher.watch = watch; executed (the execution status of this line is deduced): watcher.watch = watch; | - |
279 | if (QCoreApplication::instance()) { partially evaluated: QCoreApplication::instance() yes Evaluation Count:165 | no Evaluation Count:0 |
| 0-165 |
280 | watcher.write = new QSocketNotifier(fd, QSocketNotifier::Write, d); executed (the execution status of this line is deduced): watcher.write = new QSocketNotifier(fd, QSocketNotifier::Write, d); | - |
281 | watcher.write->setEnabled(q_dbus_watch_get_enabled(watch)); executed (the execution status of this line is deduced): watcher.write->setEnabled(q_dbus_watch_get_enabled(watch)); | - |
282 | d->connect(watcher.write, SIGNAL(activated(int)), SLOT(socketWrite(int))); executed (the execution status of this line is deduced): d->connect(watcher.write, "2""activated(int)", "1""socketWrite(int)"); | - |
283 | } executed: } Execution Count:165 | 165 |
284 | } executed: } Execution Count:165 | 165 |
285 | d->watchers.insertMulti(fd, watcher); executed (the execution status of this line is deduced): d->watchers.insertMulti(fd, watcher); | - |
286 | | - |
287 | return true; executed: return true; Execution Count:338 | 338 |
288 | } | - |
289 | | - |
290 | static void qDBusRemoveWatch(DBusWatch *watch, void *data) | - |
291 | { | - |
292 | Q_ASSERT(watch); executed (the execution status of this line is deduced): qt_noop(); | - |
293 | Q_ASSERT(data); executed (the execution status of this line is deduced): qt_noop(); | - |
294 | | - |
295 | //qDebug("remove watch"); | - |
296 | | - |
297 | QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); executed (the execution status of this line is deduced): QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); | - |
298 | int fd = q_dbus_watch_get_fd(watch); executed (the execution status of this line is deduced): int fd = q_dbus_watch_get_fd(watch); | - |
299 | | - |
300 | QDBusWatchAndTimeoutLocker locker(RemoveWatchAction, d); executed (the execution status of this line is deduced): QDBusWatchAndTimeoutLocker locker(RemoveWatchAction, d); | - |
301 | QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd); executed (the execution status of this line is deduced): QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd); | - |
302 | while (i != d->watchers.end() && i.key() == fd) { evaluated: i != d->watchers.end() yes Evaluation Count:500 | yes Evaluation Count:336 |
partially evaluated: i.key() == fd yes Evaluation Count:500 | no Evaluation Count:0 |
| 0-500 |
303 | if (i.value().watch == watch) { evaluated: i.value().watch == watch yes Evaluation Count:336 | yes Evaluation Count:164 |
| 164-336 |
304 | if (QCoreApplication::instance() && QThread::currentThread() == d->thread()) { evaluated: QCoreApplication::instance() yes Evaluation Count:308 | yes Evaluation Count:28 |
evaluated: QThread::currentThread() == d->thread() yes Evaluation Count:306 | yes Evaluation Count:2 |
| 2-308 |
305 | // correct thread, delete the socket notifiers | - |
306 | delete i.value().read; executed (the execution status of this line is deduced): delete i.value().read; | - |
307 | delete i.value().write; executed (the execution status of this line is deduced): delete i.value().write; | - |
308 | } else { executed: } Execution Count:306 | 306 |
309 | // incorrect thread or no application, use delete later | - |
310 | if (i->read) evaluated: i->read yes Evaluation Count:15 | yes Evaluation Count:15 |
| 15 |
311 | i->read->deleteLater(); executed: i->read->deleteLater(); Execution Count:15 | 15 |
312 | if (i->write) evaluated: i->write yes Evaluation Count:15 | yes Evaluation Count:15 |
| 15 |
313 | i->write->deleteLater(); executed: i->write->deleteLater(); Execution Count:15 | 15 |
314 | } executed: } Execution Count:30 | 30 |
315 | i = d->watchers.erase(i); executed (the execution status of this line is deduced): i = d->watchers.erase(i); | - |
316 | } else { executed: } Execution Count:336 | 336 |
317 | ++i; executed (the execution status of this line is deduced): ++i; | - |
318 | } executed: } Execution Count:164 | 164 |
319 | } | - |
320 | } executed: } Execution Count:336 | 336 |
321 | | - |
322 | static void qDBusRealToggleWatch(QDBusConnectionPrivate *d, DBusWatch *watch, int fd); | - |
323 | static void qDBusToggleWatch(DBusWatch *watch, void *data) | - |
324 | { | - |
325 | Q_ASSERT(watch); executed (the execution status of this line is deduced): qt_noop(); | - |
326 | Q_ASSERT(data); executed (the execution status of this line is deduced): qt_noop(); | - |
327 | | - |
328 | QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); executed (the execution status of this line is deduced): QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); | - |
329 | int fd = q_dbus_watch_get_fd(watch); executed (the execution status of this line is deduced): int fd = q_dbus_watch_get_fd(watch); | - |
330 | | - |
331 | if (QCoreApplication::instance() && QThread::currentThread() == d->thread()) { partially evaluated: QCoreApplication::instance() yes Evaluation Count:372 | no Evaluation Count:0 |
partially evaluated: QThread::currentThread() == d->thread() yes Evaluation Count:372 | no Evaluation Count:0 |
| 0-372 |
332 | qDBusRealToggleWatch(d, watch, fd); executed (the execution status of this line is deduced): qDBusRealToggleWatch(d, watch, fd); | - |
333 | } else { executed: } Execution Count:372 | 372 |
334 | QDBusConnectionCallbackEvent *ev = new QDBusConnectionCallbackEvent; never executed (the execution status of this line is deduced): QDBusConnectionCallbackEvent *ev = new QDBusConnectionCallbackEvent; | - |
335 | ev->subtype = QDBusConnectionCallbackEvent::ToggleWatch; never executed (the execution status of this line is deduced): ev->subtype = QDBusConnectionCallbackEvent::ToggleWatch; | - |
336 | ev->watch = watch; never executed (the execution status of this line is deduced): ev->watch = watch; | - |
337 | ev->fd = fd; never executed (the execution status of this line is deduced): ev->fd = fd; | - |
338 | d->postEventToThread(ToggleWatchAction, d, ev); never executed (the execution status of this line is deduced): d->postEventToThread(ToggleWatchAction, d, ev); | - |
339 | } | 0 |
340 | } | - |
341 | | - |
342 | static void qDBusRealToggleWatch(QDBusConnectionPrivate *d, DBusWatch *watch, int fd) | - |
343 | { | - |
344 | QDBusWatchAndTimeoutLocker locker(ToggleWatchAction, d); executed (the execution status of this line is deduced): QDBusWatchAndTimeoutLocker locker(ToggleWatchAction, d); | - |
345 | | - |
346 | QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd); executed (the execution status of this line is deduced): QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd); | - |
347 | while (i != d->watchers.end() && i.key() == fd) { partially evaluated: i != d->watchers.end() yes Evaluation Count:560 | no Evaluation Count:0 |
partially evaluated: i.key() == fd yes Evaluation Count:560 | no Evaluation Count:0 |
| 0-560 |
348 | if (i.value().watch == watch) { evaluated: i.value().watch == watch yes Evaluation Count:372 | yes Evaluation Count:188 |
| 188-372 |
349 | bool enabled = q_dbus_watch_get_enabled(watch); executed (the execution status of this line is deduced): bool enabled = q_dbus_watch_get_enabled(watch); | - |
350 | int flags = q_dbus_watch_get_flags(watch); executed (the execution status of this line is deduced): int flags = q_dbus_watch_get_flags(watch); | - |
351 | | - |
352 | //qDebug("toggle watch %d to %d (write: %d, read: %d)", q_dbus_watch_get_fd(watch), enabled, flags & DBUS_WATCH_WRITABLE, flags & DBUS_WATCH_READABLE); | - |
353 | | - |
354 | if (flags & DBUS_WATCH_READABLE && i.value().read) evaluated: flags & DBUS_WATCH_READABLE yes Evaluation Count:184 | yes Evaluation Count:188 |
partially evaluated: i.value().read yes Evaluation Count:184 | no Evaluation Count:0 |
| 0-188 |
355 | i.value().read->setEnabled(enabled); executed: i.value().read->setEnabled(enabled); Execution Count:184 | 184 |
356 | if (flags & DBUS_WATCH_WRITABLE && i.value().write) evaluated: flags & DBUS_WATCH_WRITABLE yes Evaluation Count:188 | yes Evaluation Count:184 |
partially evaluated: i.value().write yes Evaluation Count:188 | no Evaluation Count:0 |
| 0-188 |
357 | i.value().write->setEnabled(enabled); executed: i.value().write->setEnabled(enabled); Execution Count:188 | 188 |
358 | return; executed: return; Execution Count:372 | 372 |
359 | } | - |
360 | ++i; executed (the execution status of this line is deduced): ++i; | - |
361 | } executed: } Execution Count:188 | 188 |
362 | } | 0 |
363 | | - |
364 | static void qDBusUpdateDispatchStatus(DBusConnection *connection, DBusDispatchStatus new_status, void *data) | - |
365 | { | - |
366 | Q_ASSERT(connection); executed (the execution status of this line is deduced): qt_noop(); | - |
367 | Q_UNUSED(connection); executed (the execution status of this line is deduced): (void)connection;; | - |
368 | QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); executed (the execution status of this line is deduced): QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); | - |
369 | | - |
370 | static int slotId; // 0 is QObject::deleteLater() | - |
371 | if (!slotId) { evaluated: !slotId yes Evaluation Count:12 | yes Evaluation Count:1054 |
| 12-1054 |
372 | // it's ok to do this: there's no race condition because the store is atomic | - |
373 | // and we always set to the same value | - |
374 | slotId = QDBusConnectionPrivate::staticMetaObject.indexOfSlot("doDispatch()"); executed (the execution status of this line is deduced): slotId = QDBusConnectionPrivate::staticMetaObject.indexOfSlot("doDispatch()"); | - |
375 | } executed: } Execution Count:12 | 12 |
376 | | - |
377 | //qDBusDebug() << "Updating dispatcher status" << slotId; | - |
378 | if (new_status == DBUS_DISPATCH_DATA_REMAINS) evaluated: new_status == DBUS_DISPATCH_DATA_REMAINS yes Evaluation Count:522 | yes Evaluation Count:544 |
| 522-544 |
379 | QDBusConnectionPrivate::staticMetaObject.method(slotId). executed: QDBusConnectionPrivate::staticMetaObject.method(slotId). invoke(d, Qt::QueuedConnection); Execution Count:522 | 522 |
380 | invoke(d, Qt::QueuedConnection); executed: QDBusConnectionPrivate::staticMetaObject.method(slotId). invoke(d, Qt::QueuedConnection); Execution Count:522 | 522 |
381 | } executed: } Execution Count:1066 | 1066 |
382 | | - |
383 | static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, void *data) | - |
384 | { | - |
385 | // ### We may want to separate the server from the QDBusConnectionPrivate | - |
386 | Q_ASSERT(server); Q_UNUSED(server); executed (the execution status of this line is deduced): qt_noop(); (void)server;; | - |
387 | Q_ASSERT(connection); executed (the execution status of this line is deduced): qt_noop(); | - |
388 | Q_ASSERT(data); executed (the execution status of this line is deduced): qt_noop(); | - |
389 | | - |
390 | // keep the connection alive | - |
391 | q_dbus_connection_ref(connection); executed (the execution status of this line is deduced): q_dbus_connection_ref(connection); | - |
392 | QDBusConnectionPrivate *serverConnection = static_cast<QDBusConnectionPrivate *>(data); executed (the execution status of this line is deduced): QDBusConnectionPrivate *serverConnection = static_cast<QDBusConnectionPrivate *>(data); | - |
393 | | - |
394 | QDBusConnectionPrivate *newConnection = new QDBusConnectionPrivate(serverConnection->parent()); executed (the execution status of this line is deduced): QDBusConnectionPrivate *newConnection = new QDBusConnectionPrivate(serverConnection->parent()); | - |
395 | QMutexLocker locker(&QDBusConnectionManager::instance()->mutex); executed (the execution status of this line is deduced): QMutexLocker locker(&QDBusConnectionManager::instance()->mutex); | - |
396 | QDBusConnectionManager::instance()->setConnection(QLatin1String("QDBusServer-") + QString::number(reinterpret_cast<qulonglong>(newConnection)), newConnection); executed (the execution status of this line is deduced): QDBusConnectionManager::instance()->setConnection(QLatin1String("QDBusServer-") + QString::number(reinterpret_cast<qulonglong>(newConnection)), newConnection); | - |
397 | serverConnection->serverConnectionNames << newConnection->name; executed (the execution status of this line is deduced): serverConnection->serverConnectionNames << newConnection->name; | - |
398 | | - |
399 | // setPeer does the error handling for us | - |
400 | QDBusErrorInternal error; executed (the execution status of this line is deduced): QDBusErrorInternal error; | - |
401 | newConnection->setPeer(connection, error); executed (the execution status of this line is deduced): newConnection->setPeer(connection, error); | - |
402 | | - |
403 | QDBusConnection retval = QDBusConnectionPrivate::q(newConnection); executed (the execution status of this line is deduced): QDBusConnection retval = QDBusConnectionPrivate::q(newConnection); | - |
404 | | - |
405 | // make QDBusServer emit the newConnection signal | - |
406 | serverConnection->serverConnection(retval); executed (the execution status of this line is deduced): serverConnection->serverConnection(retval); | - |
407 | } executed: } Execution Count:17 | 17 |
408 | | - |
409 | } // extern "C" | - |
410 | | - |
411 | static QByteArray buildMatchRule(const QString &service, | - |
412 | const QString &objectPath, const QString &interface, | - |
413 | const QString &member, const QStringList &argMatch, const QString & /*signature*/) | - |
414 | { | - |
415 | QString result = QLatin1String("type='signal',"); executed (the execution status of this line is deduced): QString result = QLatin1String("type='signal',"); | - |
416 | QString keyValue = QLatin1String("%1='%2',"); executed (the execution status of this line is deduced): QString keyValue = QLatin1String("%1='%2',"); | - |
417 | | - |
418 | if (!service.isEmpty()) evaluated: !service.isEmpty() yes Evaluation Count:171 | yes Evaluation Count:126 |
| 126-171 |
419 | result += keyValue.arg(QLatin1String("sender"), service); executed: result += keyValue.arg(QLatin1String("sender"), service); Execution Count:171 | 171 |
420 | if (!objectPath.isEmpty()) evaluated: !objectPath.isEmpty() yes Evaluation Count:231 | yes Evaluation Count:66 |
| 66-231 |
421 | result += keyValue.arg(QLatin1String("path"), objectPath); executed: result += keyValue.arg(QLatin1String("path"), objectPath); Execution Count:231 | 231 |
422 | if (!interface.isEmpty()) partially evaluated: !interface.isEmpty() yes Evaluation Count:297 | no Evaluation Count:0 |
| 0-297 |
423 | result += keyValue.arg(QLatin1String("interface"), interface); executed: result += keyValue.arg(QLatin1String("interface"), interface); Execution Count:297 | 297 |
424 | if (!member.isEmpty()) partially evaluated: !member.isEmpty() yes Evaluation Count:297 | no Evaluation Count:0 |
| 0-297 |
425 | result += keyValue.arg(QLatin1String("member"), member); executed: result += keyValue.arg(QLatin1String("member"), member); Execution Count:297 | 297 |
426 | | - |
427 | // add the argument string-matching now | - |
428 | if (!argMatch.isEmpty()) { evaluated: !argMatch.isEmpty() yes Evaluation Count:45 | yes Evaluation Count:252 |
| 45-252 |
429 | keyValue = QLatin1String("arg%1='%2',"); executed (the execution status of this line is deduced): keyValue = QLatin1String("arg%1='%2',"); | - |
430 | for (int i = 0; i < argMatch.count(); ++i) evaluated: i < argMatch.count() yes Evaluation Count:59 | yes Evaluation Count:45 |
| 45-59 |
431 | if (!argMatch.at(i).isNull()) evaluated: !argMatch.at(i).isNull() yes Evaluation Count:57 | yes Evaluation Count:2 |
| 2-57 |
432 | result += keyValue.arg(i).arg(argMatch.at(i)); executed: result += keyValue.arg(i).arg(argMatch.at(i)); Execution Count:57 | 57 |
433 | } executed: } Execution Count:45 | 45 |
434 | | - |
435 | result.chop(1); // remove ending comma executed (the execution status of this line is deduced): result.chop(1); | - |
436 | return result.toLatin1(); executed: return result.toLatin1(); Execution Count:297 | 297 |
437 | } | - |
438 | | - |
439 | static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root, | - |
440 | const QString &fullpath, int &usedLength, | - |
441 | QDBusConnectionPrivate::ObjectTreeNode &result) | - |
442 | { | - |
443 | if (!fullpath.compare(QLatin1String("/")) && root->obj) { evaluated: !fullpath.compare(QLatin1String("/")) yes Evaluation Count:251 | yes Evaluation Count:187 |
evaluated: root->obj yes Evaluation Count:228 | yes Evaluation Count:23 |
| 23-251 |
444 | usedLength = 1; executed (the execution status of this line is deduced): usedLength = 1; | - |
445 | result = *root; executed (the execution status of this line is deduced): result = *root; | - |
446 | return root; executed: return root; Execution Count:228 | 228 |
447 | } | - |
448 | int start = 0; executed (the execution status of this line is deduced): int start = 0; | - |
449 | int length = fullpath.length(); executed (the execution status of this line is deduced): int length = fullpath.length(); | - |
450 | if (fullpath.at(0) == QLatin1Char('/')) partially evaluated: fullpath.at(0) == QLatin1Char('/') yes Evaluation Count:210 | no Evaluation Count:0 |
| 0-210 |
451 | start = 1; executed: start = 1; Execution Count:210 | 210 |
452 | | - |
453 | // walk the object tree | - |
454 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator node = root; executed (the execution status of this line is deduced): QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator node = root; | - |
455 | while (start < length && node) { evaluated: start < length yes Evaluation Count:295 | yes Evaluation Count:184 |
evaluated: node yes Evaluation Count:291 | yes Evaluation Count:4 |
| 4-295 |
456 | if (node->flags & QDBusConnection::ExportChildObjects) evaluated: node->flags & QDBusConnection::ExportChildObjects yes Evaluation Count:18 | yes Evaluation Count:273 |
| 18-273 |
457 | break; executed: break; Execution Count:18 | 18 |
458 | if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath)) evaluated: (node->flags & QDBusConnectionPrivate::VirtualObject) yes Evaluation Count:4 | yes Evaluation Count:269 |
partially evaluated: (node->flags & QDBusConnection::SubPath) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-269 |
459 | break; executed: break; Execution Count:4 | 4 |
460 | int end = fullpath.indexOf(QLatin1Char('/'), start); executed (the execution status of this line is deduced): int end = fullpath.indexOf(QLatin1Char('/'), start); | - |
461 | end = (end == -1 ? length : end); evaluated: end == -1 yes Evaluation Count:161 | yes Evaluation Count:108 |
| 108-161 |
462 | QStringRef pathComponent(&fullpath, start, end - start); executed (the execution status of this line is deduced): QStringRef pathComponent(&fullpath, start, end - start); | - |
463 | | - |
464 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = executed (the execution status of this line is deduced): QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = | - |
465 | std::lower_bound(node->children.constBegin(), node->children.constEnd(), pathComponent); executed (the execution status of this line is deduced): std::lower_bound(node->children.constBegin(), node->children.constEnd(), pathComponent); | - |
466 | if (it != node->children.constEnd() && it->name == pathComponent) evaluated: it != node->children.constEnd() yes Evaluation Count:252 | yes Evaluation Count:17 |
partially evaluated: it->name == pathComponent yes Evaluation Count:252 | no Evaluation Count:0 |
| 0-252 |
467 | // match | - |
468 | node = it; executed: node = it; Execution Count:252 | 252 |
469 | else | - |
470 | node = 0; executed: node = 0; Execution Count:17 | 17 |
471 | | - |
472 | start = end + 1; executed (the execution status of this line is deduced): start = end + 1; | - |
473 | } executed: } Execution Count:269 | 269 |
474 | | - |
475 | // found our object | - |
476 | usedLength = (start > length ? length : start); evaluated: start > length yes Evaluation Count:161 | yes Evaluation Count:49 |
| 49-161 |
477 | if (node) { evaluated: node yes Evaluation Count:193 | yes Evaluation Count:17 |
| 17-193 |
478 | if (node->obj || !node->children.isEmpty()) evaluated: node->obj yes Evaluation Count:142 | yes Evaluation Count:51 |
evaluated: !node->children.isEmpty() yes Evaluation Count:13 | yes Evaluation Count:38 |
| 13-142 |
479 | result = *node; executed: result = *node; Execution Count:155 | 155 |
480 | else | - |
481 | // there really is no object here | - |
482 | // we're just looking at an unused space in the QVector | - |
483 | node = 0; executed: node = 0; Execution Count:38 | 38 |
484 | } | - |
485 | return node; executed: return node; Execution Count:210 | 210 |
486 | } | - |
487 | | - |
488 | static QObject *findChildObject(const QDBusConnectionPrivate::ObjectTreeNode *root, | - |
489 | const QString &fullpath, int start) | - |
490 | { | - |
491 | int length = fullpath.length(); executed (the execution status of this line is deduced): int length = fullpath.length(); | - |
492 | | - |
493 | // any object in the tree can tell us to switch to its own object tree: | - |
494 | const QDBusConnectionPrivate::ObjectTreeNode *node = root; executed (the execution status of this line is deduced): const QDBusConnectionPrivate::ObjectTreeNode *node = root; | - |
495 | if (node && node->flags & QDBusConnection::ExportChildObjects) { partially evaluated: node yes Evaluation Count:19 | no Evaluation Count:0 |
evaluated: node->flags & QDBusConnection::ExportChildObjects yes Evaluation Count:18 | yes Evaluation Count:1 |
| 0-19 |
496 | QObject *obj = node->obj; executed (the execution status of this line is deduced): QObject *obj = node->obj; | - |
497 | | - |
498 | while (obj) { partially evaluated: obj yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
499 | if (start >= length) evaluated: start >= length yes Evaluation Count:8 | yes Evaluation Count:22 |
| 8-22 |
500 | // we're at the correct level | - |
501 | return obj; executed: return obj; Execution Count:8 | 8 |
502 | | - |
503 | int pos = fullpath.indexOf(QLatin1Char('/'), start); executed (the execution status of this line is deduced): int pos = fullpath.indexOf(QLatin1Char('/'), start); | - |
504 | pos = (pos == -1 ? length : pos); evaluated: pos == -1 yes Evaluation Count:16 | yes Evaluation Count:6 |
| 6-16 |
505 | QStringRef pathComponent(&fullpath, start, pos - start); executed (the execution status of this line is deduced): QStringRef pathComponent(&fullpath, start, pos - start); | - |
506 | | - |
507 | const QObjectList children = obj->children(); executed (the execution status of this line is deduced): const QObjectList children = obj->children(); | - |
508 | | - |
509 | // find a child with the proper name | - |
510 | QObject *next = 0; executed (the execution status of this line is deduced): QObject *next = 0; | - |
511 | QObjectList::ConstIterator it = children.constBegin(); executed (the execution status of this line is deduced): QObjectList::ConstIterator it = children.constBegin(); | - |
512 | QObjectList::ConstIterator end = children.constEnd(); executed (the execution status of this line is deduced): QObjectList::ConstIterator end = children.constEnd(); | - |
513 | for ( ; it != end; ++it) evaluated: it != end yes Evaluation Count:42 | yes Evaluation Count:10 |
| 10-42 |
514 | if ((*it)->objectName() == pathComponent) { evaluated: (*it)->objectName() == pathComponent yes Evaluation Count:12 | yes Evaluation Count:30 |
| 12-30 |
515 | next = *it; executed (the execution status of this line is deduced): next = *it; | - |
516 | break; executed: break; Execution Count:12 | 12 |
517 | } | - |
518 | | - |
519 | if (!next) evaluated: !next yes Evaluation Count:10 | yes Evaluation Count:12 |
| 10-12 |
520 | break; executed: break; Execution Count:10 | 10 |
521 | | - |
522 | obj = next; executed (the execution status of this line is deduced): obj = next; | - |
523 | start = pos + 1; executed (the execution status of this line is deduced): start = pos + 1; | - |
524 | } executed: } Execution Count:12 | 12 |
525 | } executed: } Execution Count:10 | 10 |
526 | | - |
527 | // object not found | - |
528 | return 0; executed: return 0; Execution Count:11 | 11 |
529 | } | - |
530 | | - |
531 | static bool shouldWatchService(const QString &service) | - |
532 | { | - |
533 | return !service.isEmpty() && !service.startsWith(QLatin1Char(':')); executed: return !service.isEmpty() && !service.startsWith(QLatin1Char(':')); Execution Count:261 | 261 |
534 | } | - |
535 | | - |
536 | extern Q_DBUS_EXPORT void qDBusAddSpyHook(QDBusSpyHook); | - |
537 | void qDBusAddSpyHook(QDBusSpyHook hook) | - |
538 | { | - |
539 | qDBusSpyHookList()->append(hook); never executed (the execution status of this line is deduced): qDBusSpyHookList()->append(hook); | - |
540 | } | 0 |
541 | | - |
542 | extern "C" { | - |
543 | static DBusHandlerResult | - |
544 | qDBusSignalFilter(DBusConnection *connection, DBusMessage *message, void *data) | - |
545 | { | - |
546 | Q_ASSERT(data); executed (the execution status of this line is deduced): qt_noop(); | - |
547 | Q_UNUSED(connection); executed (the execution status of this line is deduced): (void)connection;; | - |
548 | QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); executed (the execution status of this line is deduced): QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data); | - |
549 | if (d->mode == QDBusConnectionPrivate::InvalidMode) evaluated: d->mode == QDBusConnectionPrivate::InvalidMode yes Evaluation Count:171 | yes Evaluation Count:275 |
| 171-275 |
550 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; executed: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; Execution Count:171 | 171 |
551 | | - |
552 | QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(message, d->capabilities); executed (the execution status of this line is deduced): QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(message, d->capabilities); | - |
553 | qDBusDebug() << d << "got message (signal):" << amsg; executed: ; Execution Count:275 never executed: QMessageLogger("qdbusintegrator.cpp", 553, __PRETTY_FUNCTION__).debug() << d << "got message (signal):" << amsg; partially evaluated: !::isDebugging yes Evaluation Count:275 | no Evaluation Count:0 |
| 0-275 |
554 | | - |
555 | return d->handleMessage(amsg) ? executed: return d->handleMessage(amsg) ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED; Execution Count:275 | 275 |
556 | DBUS_HANDLER_RESULT_HANDLED : executed: return d->handleMessage(amsg) ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED; Execution Count:275 | 275 |
557 | DBUS_HANDLER_RESULT_NOT_YET_HANDLED; executed: return d->handleMessage(amsg) ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED; Execution Count:275 | 275 |
558 | } | - |
559 | } | - |
560 | | - |
561 | bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg) | - |
562 | { | - |
563 | const QDBusSpyHookList *list = qDBusSpyHookList(); executed (the execution status of this line is deduced): const QDBusSpyHookList *list = qDBusSpyHookList(); | - |
564 | for (int i = 0; i < list->size(); ++i) { partially evaluated: i < list->size() no Evaluation Count:0 | yes Evaluation Count:639 |
| 0-639 |
565 | qDBusDebug() << "calling the message spy hook"; never executed: ; never executed: QMessageLogger("qdbusintegrator.cpp", 565, __PRETTY_FUNCTION__).debug() << "calling the message spy hook"; never evaluated: !::isDebugging | 0 |
566 | (*(*list)[i])(amsg); never executed (the execution status of this line is deduced): (*(*list)[i])(amsg); | - |
567 | } | 0 |
568 | | - |
569 | if (!ref.load()) evaluated: !ref.load() yes Evaluation Count:1 | yes Evaluation Count:638 |
| 1-638 |
570 | return false; executed: return false; Execution Count:1 | 1 |
571 | | - |
572 | switch (amsg.type()) { | - |
573 | case QDBusMessage::SignalMessage: | - |
574 | handleSignal(amsg); executed (the execution status of this line is deduced): handleSignal(amsg); | - |
575 | // if there are any other filters in this DBusConnection, | - |
576 | // let them see the signal too | - |
577 | return false; executed: return false; Execution Count:197 | 197 |
578 | case QDBusMessage::MethodCallMessage: | - |
579 | handleObjectCall(amsg); executed (the execution status of this line is deduced): handleObjectCall(amsg); | - |
580 | return true; executed: return true; Execution Count:438 | 438 |
581 | case QDBusMessage::ReplyMessage: | - |
582 | case QDBusMessage::ErrorMessage: | - |
583 | case QDBusMessage::InvalidMessage: | - |
584 | return false; // we don't handle those here executed: return false; Execution Count:3 | 3 |
585 | } | - |
586 | | - |
587 | return false; never executed: return false; | 0 |
588 | } | - |
589 | | - |
590 | static void huntAndDestroy(QObject *needle, QDBusConnectionPrivate::ObjectTreeNode &haystack) | - |
591 | { | - |
592 | QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = haystack.children.begin(); executed (the execution status of this line is deduced): QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = haystack.children.begin(); | - |
593 | QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator end = haystack.children.end(); executed (the execution status of this line is deduced): QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator end = haystack.children.end(); | - |
594 | for ( ; it != end; ++it) evaluated: it != end yes Evaluation Count:264 | yes Evaluation Count:459 |
| 264-459 |
595 | huntAndDestroy(needle, *it); executed: huntAndDestroy(needle, *it); Execution Count:264 | 264 |
596 | | - |
597 | if (needle == haystack.obj) { evaluated: needle == haystack.obj yes Evaluation Count:106 | yes Evaluation Count:353 |
| 106-353 |
598 | haystack.obj = 0; executed (the execution status of this line is deduced): haystack.obj = 0; | - |
599 | haystack.flags = 0; executed (the execution status of this line is deduced): haystack.flags = 0; | - |
600 | } executed: } Execution Count:106 | 106 |
601 | } executed: } Execution Count:459 | 459 |
602 | | - |
603 | static void huntAndEmit(DBusConnection *connection, DBusMessage *msg, | - |
604 | QObject *needle, const QDBusConnectionPrivate::ObjectTreeNode &haystack, | - |
605 | bool isScriptable, bool isAdaptor, const QString &path = QString()) | - |
606 | { | - |
607 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = haystack.children.constBegin(); executed (the execution status of this line is deduced): QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = haystack.children.constBegin(); | - |
608 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end = haystack.children.constEnd(); executed (the execution status of this line is deduced): QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end = haystack.children.constEnd(); | - |
609 | for ( ; it != end; ++it) evaluated: it != end yes Evaluation Count:36 | yes Evaluation Count:128 |
| 36-128 |
610 | huntAndEmit(connection, msg, needle, *it, isScriptable, isAdaptor, path + QLatin1Char('/') + it->name); executed: huntAndEmit(connection, msg, needle, *it, isScriptable, isAdaptor, path + QLatin1Char('/') + it->name); Execution Count:36 | 36 |
611 | | - |
612 | if (needle == haystack.obj) { evaluated: needle == haystack.obj yes Evaluation Count:95 | yes Evaluation Count:33 |
| 33-95 |
613 | // is this a signal we should relay? | - |
614 | if (isAdaptor && (haystack.flags & QDBusConnection::ExportAdaptors) == 0) evaluated: isAdaptor yes Evaluation Count:50 | yes Evaluation Count:45 |
partially evaluated: (haystack.flags & QDBusConnection::ExportAdaptors) == 0 no Evaluation Count:0 | yes Evaluation Count:50 |
| 0-50 |
615 | return; // no: it comes from an adaptor and we're not exporting adaptors | 0 |
616 | else if (!isAdaptor) { evaluated: !isAdaptor yes Evaluation Count:45 | yes Evaluation Count:50 |
| 45-50 |
617 | int mask = isScriptable evaluated: isScriptable yes Evaluation Count:40 | yes Evaluation Count:5 |
| 5-40 |
618 | ? QDBusConnection::ExportScriptableSignals executed (the execution status of this line is deduced): ? QDBusConnection::ExportScriptableSignals | - |
619 | : QDBusConnection::ExportNonScriptableSignals; executed (the execution status of this line is deduced): : QDBusConnection::ExportNonScriptableSignals; | - |
620 | if ((haystack.flags & mask) == 0) evaluated: (haystack.flags & mask) == 0 yes Evaluation Count:2 | yes Evaluation Count:43 |
| 2-43 |
621 | return; // signal was not exported executed: return; Execution Count:2 | 2 |
622 | } executed: } Execution Count:43 | 43 |
623 | | - |
624 | QByteArray p = path.toLatin1(); executed (the execution status of this line is deduced): QByteArray p = path.toLatin1(); | - |
625 | if (p.isEmpty()) evaluated: p.isEmpty() yes Evaluation Count:86 | yes Evaluation Count:7 |
| 7-86 |
626 | p = "/"; executed: p = "/"; Execution Count:86 | 86 |
627 | qDBusDebug() << QThread::currentThread() << "emitting signal at" << p; executed: ; Execution Count:93 never executed: QMessageLogger("qdbusintegrator.cpp", 627, __PRETTY_FUNCTION__).debug() << QThread::currentThread() << "emitting signal at" << p; partially evaluated: !::isDebugging yes Evaluation Count:93 | no Evaluation Count:0 |
| 0-93 |
628 | DBusMessage *msg2 = q_dbus_message_copy(msg); executed (the execution status of this line is deduced): DBusMessage *msg2 = q_dbus_message_copy(msg); | - |
629 | q_dbus_message_set_path(msg2, p); executed (the execution status of this line is deduced): q_dbus_message_set_path(msg2, p); | - |
630 | q_dbus_connection_send(connection, msg2, 0); executed (the execution status of this line is deduced): q_dbus_connection_send(connection, msg2, 0); | - |
631 | q_dbus_message_unref(msg2); executed (the execution status of this line is deduced): q_dbus_message_unref(msg2); | - |
632 | } executed: } Execution Count:93 | 93 |
633 | } executed: } Execution Count:126 | 126 |
634 | | - |
635 | static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags, | - |
636 | const QString &signature_, QVector<int> &metaTypes) | - |
637 | { | - |
638 | QByteArray msgSignature = signature_.toLatin1(); executed (the execution status of this line is deduced): QByteArray msgSignature = signature_.toLatin1(); | - |
639 | | - |
640 | for (int idx = mo->methodCount() - 1 ; idx >= QObject::staticMetaObject.methodCount(); --idx) { evaluated: idx >= QObject::staticMetaObject.methodCount() yes Evaluation Count:1498 | yes Evaluation Count:41 |
| 41-1498 |
641 | QMetaMethod mm = mo->method(idx); executed (the execution status of this line is deduced): QMetaMethod mm = mo->method(idx); | - |
642 | | - |
643 | // check access: | - |
644 | if (mm.access() != QMetaMethod::Public) evaluated: mm.access() != QMetaMethod::Public yes Evaluation Count:100 | yes Evaluation Count:1398 |
| 100-1398 |
645 | continue; executed: continue; Execution Count:100 | 100 |
646 | | - |
647 | // check type: | - |
648 | if (mm.methodType() != QMetaMethod::Slot && mm.methodType() != QMetaMethod::Method) evaluated: mm.methodType() != QMetaMethod::Slot yes Evaluation Count:10 | yes Evaluation Count:1388 |
partially evaluated: mm.methodType() != QMetaMethod::Method no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-1388 |
649 | continue; never executed: continue; | 0 |
650 | | - |
651 | // check name: | - |
652 | if (mm.name() != name) evaluated: mm.name() != name yes Evaluation Count:1225 | yes Evaluation Count:173 |
| 173-1225 |
653 | continue; executed: continue; Execution Count:1225 | 1225 |
654 | | - |
655 | int returnType = mm.returnType(); executed (the execution status of this line is deduced): int returnType = mm.returnType(); | - |
656 | bool isAsync = qDBusCheckAsyncTag(mm.tag()); executed (the execution status of this line is deduced): bool isAsync = qDBusCheckAsyncTag(mm.tag()); | - |
657 | bool isScriptable = mm.attributes() & QMetaMethod::Scriptable; executed (the execution status of this line is deduced): bool isScriptable = mm.attributes() & QMetaMethod::Scriptable; | - |
658 | | - |
659 | // consistency check: | - |
660 | if (isAsync && returnType != QMetaType::Void) partially evaluated: isAsync no Evaluation Count:0 | yes Evaluation Count:173 |
never evaluated: returnType != QMetaType::Void | 0-173 |
661 | continue; never executed: continue; | 0 |
662 | | - |
663 | int inputCount = qDBusParametersForMethod(mm, metaTypes); executed (the execution status of this line is deduced): int inputCount = qDBusParametersForMethod(mm, metaTypes); | - |
664 | if (inputCount == -1) evaluated: inputCount == -1 yes Evaluation Count:5 | yes Evaluation Count:168 |
| 5-168 |
665 | continue; // problem parsing executed: continue; Execution Count:5 | 5 |
666 | | - |
667 | metaTypes[0] = returnType; executed (the execution status of this line is deduced): metaTypes[0] = returnType; | - |
668 | bool hasMessage = false; executed (the execution status of this line is deduced): bool hasMessage = false; | - |
669 | if (inputCount > 0 && evaluated: inputCount > 0 yes Evaluation Count:86 | yes Evaluation Count:82 |
| 82-86 |
670 | metaTypes.at(inputCount) == QDBusMetaTypeId::message()) { evaluated: metaTypes.at(inputCount) == QDBusMetaTypeId::message() yes Evaluation Count:41 | yes Evaluation Count:45 |
| 41-45 |
671 | // "no input parameters" is allowed as long as the message meta type is there | - |
672 | hasMessage = true; executed (the execution status of this line is deduced): hasMessage = true; | - |
673 | --inputCount; executed (the execution status of this line is deduced): --inputCount; | - |
674 | } executed: } Execution Count:41 | 41 |
675 | | - |
676 | // try to match the parameters | - |
677 | int i; executed (the execution status of this line is deduced): int i; | - |
678 | QByteArray reconstructedSignature; executed (the execution status of this line is deduced): QByteArray reconstructedSignature; | - |
679 | for (i = 1; i <= inputCount; ++i) { evaluated: i <= inputCount yes Evaluation Count:45 | yes Evaluation Count:156 |
| 45-156 |
680 | const char *typeSignature = QDBusMetaType::typeToSignature( metaTypes.at(i) ); executed (the execution status of this line is deduced): const char *typeSignature = QDBusMetaType::typeToSignature( metaTypes.at(i) ); | - |
681 | if (!typeSignature) partially evaluated: !typeSignature no Evaluation Count:0 | yes Evaluation Count:45 |
| 0-45 |
682 | break; // invalid | 0 |
683 | | - |
684 | reconstructedSignature += typeSignature; executed (the execution status of this line is deduced): reconstructedSignature += typeSignature; | - |
685 | if (!msgSignature.startsWith(reconstructedSignature)) evaluated: !msgSignature.startsWith(reconstructedSignature) yes Evaluation Count:12 | yes Evaluation Count:33 |
| 12-33 |
686 | break; executed: break; Execution Count:12 | 12 |
687 | } executed: } Execution Count:33 | 33 |
688 | | - |
689 | if (reconstructedSignature != msgSignature) evaluated: reconstructedSignature != msgSignature yes Evaluation Count:17 | yes Evaluation Count:151 |
| 17-151 |
690 | continue; // we didn't match them all executed: continue; Execution Count:17 | 17 |
691 | | - |
692 | if (hasMessage) evaluated: hasMessage yes Evaluation Count:36 | yes Evaluation Count:115 |
| 36-115 |
693 | ++i; executed: ++i; Execution Count:36 | 36 |
694 | | - |
695 | // make sure that the output parameters have signatures too | - |
696 | if (returnType != QMetaType::UnknownType && returnType != QMetaType::Void && QDBusMetaType::typeToSignature(returnType) == 0) partially evaluated: returnType != QMetaType::UnknownType yes Evaluation Count:151 | no Evaluation Count:0 |
evaluated: returnType != QMetaType::Void yes Evaluation Count:70 | yes Evaluation Count:81 |
partially evaluated: QDBusMetaType::typeToSignature(returnType) == 0 no Evaluation Count:0 | yes Evaluation Count:70 |
| 0-151 |
697 | continue; never executed: continue; | 0 |
698 | | - |
699 | bool ok = true; executed (the execution status of this line is deduced): bool ok = true; | - |
700 | for (int j = i; ok && j < metaTypes.count(); ++j) partially evaluated: ok yes Evaluation Count:156 | no Evaluation Count:0 |
evaluated: j < metaTypes.count() yes Evaluation Count:5 | yes Evaluation Count:151 |
| 0-156 |
701 | if (QDBusMetaType::typeToSignature(metaTypes.at(i)) == 0) partially evaluated: QDBusMetaType::typeToSignature(metaTypes.at(i)) == 0 no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
702 | ok = false; never executed: ok = false; | 0 |
703 | if (!ok) partially evaluated: !ok no Evaluation Count:0 | yes Evaluation Count:151 |
| 0-151 |
704 | continue; never executed: continue; | 0 |
705 | | - |
706 | // consistency check: | - |
707 | if (isAsync && metaTypes.count() > i + 1) partially evaluated: isAsync no Evaluation Count:0 | yes Evaluation Count:151 |
never evaluated: metaTypes.count() > i + 1 | 0-151 |
708 | continue; never executed: continue; | 0 |
709 | | - |
710 | if (mm.methodType() == QMetaMethod::Slot) { evaluated: mm.methodType() == QMetaMethod::Slot yes Evaluation Count:149 | yes Evaluation Count:2 |
| 2-149 |
711 | if (isScriptable && (flags & QDBusConnection::ExportScriptableSlots) == 0) evaluated: isScriptable yes Evaluation Count:12 | yes Evaluation Count:137 |
partially evaluated: (flags & QDBusConnection::ExportScriptableSlots) == 0 no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-137 |
712 | continue; // scriptable slots not exported never executed: continue; | 0 |
713 | if (!isScriptable && (flags & QDBusConnection::ExportNonScriptableSlots) == 0) evaluated: !isScriptable yes Evaluation Count:137 | yes Evaluation Count:12 |
partially evaluated: (flags & QDBusConnection::ExportNonScriptableSlots) == 0 no Evaluation Count:0 | yes Evaluation Count:137 |
| 0-137 |
714 | continue; // non-scriptable slots not exported never executed: continue; | 0 |
715 | } else { executed: } Execution Count:149 | 149 |
716 | if (isScriptable && (flags & QDBusConnection::ExportScriptableInvokables) == 0) partially evaluated: isScriptable no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: (flags & QDBusConnection::ExportScriptableInvokables) == 0 | 0-2 |
717 | continue; // scriptable invokables not exported never executed: continue; | 0 |
718 | if (!isScriptable && (flags & QDBusConnection::ExportNonScriptableInvokables) == 0) partially evaluated: !isScriptable yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: (flags & QDBusConnection::ExportNonScriptableInvokables) == 0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
719 | continue; // non-scriptable invokables not exported never executed: continue; | 0 |
720 | } executed: } Execution Count:2 | 2 |
721 | | - |
722 | // if we got here, this slot matched | - |
723 | return idx; executed: return idx; Execution Count:151 | 151 |
724 | } | - |
725 | | - |
726 | // no slot matched | - |
727 | return -1; executed: return -1; Execution Count:41 | 41 |
728 | } | - |
729 | | - |
730 | static QDBusCallDeliveryEvent * const DIRECT_DELIVERY = (QDBusCallDeliveryEvent *)1; | - |
731 | | - |
732 | QDBusCallDeliveryEvent* QDBusConnectionPrivate::prepareReply(QDBusConnectionPrivate *target, | - |
733 | QObject *object, int idx, | - |
734 | const QVector<int> &metaTypes, | - |
735 | const QDBusMessage &msg) | - |
736 | { | - |
737 | Q_ASSERT(object); executed (the execution status of this line is deduced): qt_noop(); | - |
738 | Q_UNUSED(object); executed (the execution status of this line is deduced): (void)object;; | - |
739 | | - |
740 | int n = metaTypes.count() - 1; executed (the execution status of this line is deduced): int n = metaTypes.count() - 1; | - |
741 | if (metaTypes[n] == QDBusMetaTypeId::message()) evaluated: metaTypes[n] == QDBusMetaTypeId::message() yes Evaluation Count:53 | yes Evaluation Count:103 |
| 53-103 |
742 | --n; executed: --n; Execution Count:53 | 53 |
743 | | - |
744 | if (msg.arguments().count() < n) partially evaluated: msg.arguments().count() < n no Evaluation Count:0 | yes Evaluation Count:156 |
| 0-156 |
745 | return 0; // too few arguments never executed: return 0; | 0 |
746 | | - |
747 | // check that types match | - |
748 | for (int i = 0; i < n; ++i) evaluated: i < n yes Evaluation Count:118 | yes Evaluation Count:156 |
| 118-156 |
749 | if (metaTypes.at(i + 1) != msg.arguments().at(i).userType() && evaluated: metaTypes.at(i + 1) != msg.arguments().at(i).userType() yes Evaluation Count:6 | yes Evaluation Count:112 |
| 6-112 |
750 | msg.arguments().at(i).userType() != qMetaTypeId<QDBusArgument>()) partially evaluated: msg.arguments().at(i).userType() != qMetaTypeId<QDBusArgument>() no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
751 | return 0; // no match never executed: return 0; | 0 |
752 | | - |
753 | // we can deliver | - |
754 | // prepare for the call | - |
755 | if (target == object) evaluated: target == object yes Evaluation Count:41 | yes Evaluation Count:115 |
| 41-115 |
756 | return DIRECT_DELIVERY; executed: return DIRECT_DELIVERY; Execution Count:41 | 41 |
757 | return new QDBusCallDeliveryEvent(QDBusConnection(target), idx, target, msg, metaTypes); executed: return new QDBusCallDeliveryEvent(QDBusConnection(target), idx, target, msg, metaTypes); Execution Count:115 | 115 |
758 | } | - |
759 | | - |
760 | void QDBusConnectionPrivate::activateSignal(const QDBusConnectionPrivate::SignalHook& hook, | - |
761 | const QDBusMessage &msg) | - |
762 | { | - |
763 | // This is called by QDBusConnectionPrivate::handleSignal to deliver a signal | - |
764 | // that was received from D-Bus | - |
765 | // | - |
766 | // Signals are delivered to slots if the parameters match | - |
767 | // Slots can have less parameters than there are on the message | - |
768 | // Slots can optionally have one final parameter that is a QDBusMessage | - |
769 | // Slots receive read-only copies of the message (i.e., pass by value or by const-ref) | - |
770 | QDBusCallDeliveryEvent *call = prepareReply(this, hook.obj, hook.midx, hook.params, msg); executed (the execution status of this line is deduced): QDBusCallDeliveryEvent *call = prepareReply(this, hook.obj, hook.midx, hook.params, msg); | - |
771 | if (call == DIRECT_DELIVERY) { evaluated: call == DIRECT_DELIVERY yes Evaluation Count:41 | yes Evaluation Count:108 |
| 41-108 |
772 | // short-circuit delivery | - |
773 | Q_ASSERT(this == hook.obj); executed (the execution status of this line is deduced): qt_noop(); | - |
774 | deliverCall(this, 0, msg, hook.params, hook.midx); executed (the execution status of this line is deduced): deliverCall(this, 0, msg, hook.params, hook.midx); | - |
775 | return; executed: return; Execution Count:41 | 41 |
776 | } | - |
777 | if (call) partially evaluated: call yes Evaluation Count:108 | no Evaluation Count:0 |
| 0-108 |
778 | postEventToThread(ActivateSignalAction, hook.obj, call); executed: postEventToThread(ActivateSignalAction, hook.obj, call); Execution Count:108 | 108 |
779 | } executed: } Execution Count:108 | 108 |
780 | | - |
781 | bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBusMessage &msg) | - |
782 | { | - |
783 | // This is called by QDBusConnectionPrivate::handleObjectCall to place a call | - |
784 | // to a slot on the object. | - |
785 | // | - |
786 | // The call is delivered to the first slot that matches the following conditions: | - |
787 | // - has the same name as the message's target member | - |
788 | // - ALL of the message's types are found in slot's parameter list | - |
789 | // - optionally has one more parameter of type QDBusMessage | - |
790 | // If none match, then the slot of the same name as the message target and with | - |
791 | // the first type of QDBusMessage is delivered. | - |
792 | // | - |
793 | // The D-Bus specification requires that all MethodCall messages be replied to, unless the | - |
794 | // caller specifically waived this requirement. This means that we inspect if the user slot | - |
795 | // generated a reply and, if it didn't, we will. Obviously, if the user slot doesn't take a | - |
796 | // QDBusMessage parameter, it cannot generate a reply. | - |
797 | // | - |
798 | // When a return message is generated, the slot's return type, if any, will be placed | - |
799 | // in the message's first position. If there are non-const reference parameters to the | - |
800 | // slot, they must appear at the end and will be placed in the subsequent message | - |
801 | // positions. | - |
802 | | - |
803 | static const char cachePropertyName[] = "_qdbus_slotCache"; | - |
804 | | - |
805 | if (!object) partially evaluated: !object no Evaluation Count:0 | yes Evaluation Count:258 |
| 0-258 |
806 | return false; never executed: return false; | 0 |
807 | | - |
808 | #ifndef QT_NO_PROPERTIES | - |
809 | Q_ASSERT_X(QThread::currentThread() == object->thread(), executed (the execution status of this line is deduced): qt_noop(); | - |
810 | "QDBusConnection: internal threading error", | - |
811 | "function called for an object that is in another thread!!"); | - |
812 | | - |
813 | QDBusSlotCache slotCache = executed (the execution status of this line is deduced): QDBusSlotCache slotCache = | - |
814 | qvariant_cast<QDBusSlotCache>(object->property(cachePropertyName)); executed (the execution status of this line is deduced): qvariant_cast<QDBusSlotCache>(object->property(cachePropertyName)); | - |
815 | QString cacheKey = msg.member(), signature = msg.signature(); executed (the execution status of this line is deduced): QString cacheKey = msg.member(), signature = msg.signature(); | - |
816 | if (!signature.isEmpty()) { evaluated: !signature.isEmpty() yes Evaluation Count:57 | yes Evaluation Count:201 |
| 57-201 |
817 | cacheKey.reserve(cacheKey.length() + 1 + signature.length()); executed (the execution status of this line is deduced): cacheKey.reserve(cacheKey.length() + 1 + signature.length()); | - |
818 | cacheKey += QLatin1Char('.'); executed (the execution status of this line is deduced): cacheKey += QLatin1Char('.'); | - |
819 | cacheKey += signature; executed (the execution status of this line is deduced): cacheKey += signature; | - |
820 | } executed: } Execution Count:57 | 57 |
821 | | - |
822 | QDBusSlotCache::Hash::ConstIterator cacheIt = slotCache.hash.constFind(cacheKey); executed (the execution status of this line is deduced): QDBusSlotCache::Hash::ConstIterator cacheIt = slotCache.hash.constFind(cacheKey); | - |
823 | while (cacheIt != slotCache.hash.constEnd() && cacheIt->flags != flags && evaluated: cacheIt != slotCache.hash.constEnd() yes Evaluation Count:89 | yes Evaluation Count:169 |
partially evaluated: cacheIt->flags != flags no Evaluation Count:0 | yes Evaluation Count:89 |
| 0-169 |
824 | cacheIt.key() == cacheKey) never evaluated: cacheIt.key() == cacheKey | 0 |
825 | ++cacheIt; never executed: ++cacheIt; | 0 |
826 | if (cacheIt == slotCache.hash.constEnd() || cacheIt.key() != cacheKey) evaluated: cacheIt == slotCache.hash.constEnd() yes Evaluation Count:169 | yes Evaluation Count:89 |
partially evaluated: cacheIt.key() != cacheKey no Evaluation Count:0 | yes Evaluation Count:89 |
| 0-169 |
827 | { | - |
828 | // not cached, analyze the meta object | - |
829 | const QMetaObject *mo = object->metaObject(); executed (the execution status of this line is deduced): const QMetaObject *mo = object->metaObject(); | - |
830 | QByteArray memberName = msg.member().toUtf8(); executed (the execution status of this line is deduced): QByteArray memberName = msg.member().toUtf8(); | - |
831 | | - |
832 | // find a slot that matches according to the rules above | - |
833 | QDBusSlotCache::Data slotData; executed (the execution status of this line is deduced): QDBusSlotCache::Data slotData; | - |
834 | slotData.flags = flags; executed (the execution status of this line is deduced): slotData.flags = flags; | - |
835 | slotData.slotIdx = ::findSlot(mo, memberName, flags, msg.signature(), slotData.metaTypes); executed (the execution status of this line is deduced): slotData.slotIdx = ::findSlot(mo, memberName, flags, msg.signature(), slotData.metaTypes); | - |
836 | if (slotData.slotIdx == -1) { evaluated: slotData.slotIdx == -1 yes Evaluation Count:23 | yes Evaluation Count:146 |
| 23-146 |
837 | // ### this is where we want to add the connection as an arg too | - |
838 | // try with no parameters, but with a QDBusMessage | - |
839 | slotData.slotIdx = ::findSlot(mo, memberName, flags, QString(), slotData.metaTypes); executed (the execution status of this line is deduced): slotData.slotIdx = ::findSlot(mo, memberName, flags, QString(), slotData.metaTypes); | - |
840 | if (slotData.metaTypes.count() != 2 || evaluated: slotData.metaTypes.count() != 2 yes Evaluation Count:17 | yes Evaluation Count:6 |
| 6-17 |
841 | slotData.metaTypes.at(1) != QDBusMetaTypeId::message()) { evaluated: slotData.metaTypes.at(1) != QDBusMetaTypeId::message() yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
842 | // not found | - |
843 | // save the negative lookup | - |
844 | slotData.slotIdx = -1; executed (the execution status of this line is deduced): slotData.slotIdx = -1; | - |
845 | slotData.metaTypes.clear(); executed (the execution status of this line is deduced): slotData.metaTypes.clear(); | - |
846 | slotCache.hash.insert(cacheKey, slotData); executed (the execution status of this line is deduced): slotCache.hash.insert(cacheKey, slotData); | - |
847 | object->setProperty(cachePropertyName, QVariant::fromValue(slotCache)); executed (the execution status of this line is deduced): object->setProperty(cachePropertyName, QVariant::fromValue(slotCache)); | - |
848 | return false; executed: return false; Execution Count:18 | 18 |
849 | } | - |
850 | } executed: } Execution Count:5 | 5 |
851 | | - |
852 | // save to the cache | - |
853 | slotCache.hash.insert(cacheKey, slotData); executed (the execution status of this line is deduced): slotCache.hash.insert(cacheKey, slotData); | - |
854 | object->setProperty(cachePropertyName, QVariant::fromValue(slotCache)); executed (the execution status of this line is deduced): object->setProperty(cachePropertyName, QVariant::fromValue(slotCache)); | - |
855 | | - |
856 | // found the slot to be called | - |
857 | deliverCall(object, flags, msg, slotData.metaTypes, slotData.slotIdx); executed (the execution status of this line is deduced): deliverCall(object, flags, msg, slotData.metaTypes, slotData.slotIdx); | - |
858 | return true; executed: return true; Execution Count:151 | 151 |
859 | } else if (cacheIt->slotIdx == -1) { evaluated: cacheIt->slotIdx == -1 yes Evaluation Count:1 | yes Evaluation Count:88 |
| 1-88 |
860 | // negative cache | - |
861 | return false; executed: return false; Execution Count:1 | 1 |
862 | } else { | - |
863 | // use the cache | - |
864 | deliverCall(object, flags, msg, cacheIt->metaTypes, cacheIt->slotIdx); executed (the execution status of this line is deduced): deliverCall(object, flags, msg, cacheIt->metaTypes, cacheIt->slotIdx); | - |
865 | return true; executed: return true; Execution Count:88 | 88 |
866 | } | - |
867 | #endif // QT_NO_PROPERTIES | - |
868 | return false; | - |
869 | } | - |
870 | | - |
871 | void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const QDBusMessage &msg, | - |
872 | const QVector<int> &metaTypes, int slotIdx) | - |
873 | { | - |
874 | Q_ASSERT_X(!object || QThread::currentThread() == object->thread(), executed (the execution status of this line is deduced): qt_noop(); | - |
875 | "QDBusConnection: internal threading error", | - |
876 | "function called for an object that is in another thread!!"); | - |
877 | | - |
878 | QVarLengthArray<void *, 10> params; executed (the execution status of this line is deduced): QVarLengthArray<void *, 10> params; | - |
879 | params.reserve(metaTypes.count()); executed (the execution status of this line is deduced): params.reserve(metaTypes.count()); | - |
880 | | - |
881 | QVariantList auxParameters; executed (the execution status of this line is deduced): QVariantList auxParameters; | - |
882 | // let's create the parameter list | - |
883 | | - |
884 | // first one is the return type -- add it below | - |
885 | params.append(0); executed (the execution status of this line is deduced): params.append(0); | - |
886 | | - |
887 | // add the input parameters | - |
888 | int i; executed (the execution status of this line is deduced): int i; | - |
889 | int pCount = qMin(msg.arguments().count(), metaTypes.count() - 1); executed (the execution status of this line is deduced): int pCount = qMin(msg.arguments().count(), metaTypes.count() - 1); | - |
890 | for (i = 1; i <= pCount; ++i) { evaluated: i <= pCount yes Evaluation Count:200 | yes Evaluation Count:360 |
| 200-360 |
891 | int id = metaTypes[i]; executed (the execution status of this line is deduced): int id = metaTypes[i]; | - |
892 | if (id == QDBusMetaTypeId::message()) evaluated: id == QDBusMetaTypeId::message() yes Evaluation Count:35 | yes Evaluation Count:165 |
| 35-165 |
893 | break; executed: break; Execution Count:35 | 35 |
894 | | - |
895 | const QVariant &arg = msg.arguments().at(i - 1); executed (the execution status of this line is deduced): const QVariant &arg = msg.arguments().at(i - 1); | - |
896 | if (arg.userType() == id) evaluated: arg.userType() == id yes Evaluation Count:152 | yes Evaluation Count:13 |
| 13-152 |
897 | // no conversion needed | - |
898 | params.append(const_cast<void *>(arg.constData())); executed: params.append(const_cast<void *>(arg.constData())); Execution Count:152 | 152 |
899 | else if (arg.userType() == qMetaTypeId<QDBusArgument>()) { partially evaluated: arg.userType() == qMetaTypeId<QDBusArgument>() yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
900 | // convert to what the function expects | - |
901 | void *null = 0; executed (the execution status of this line is deduced): void *null = 0; | - |
902 | auxParameters.append(QVariant(id, null)); executed (the execution status of this line is deduced): auxParameters.append(QVariant(id, null)); | - |
903 | | - |
904 | const QDBusArgument &in = executed (the execution status of this line is deduced): const QDBusArgument &in = | - |
905 | *reinterpret_cast<const QDBusArgument *>(arg.constData()); executed (the execution status of this line is deduced): *reinterpret_cast<const QDBusArgument *>(arg.constData()); | - |
906 | QVariant &out = auxParameters[auxParameters.count() - 1]; executed (the execution status of this line is deduced): QVariant &out = auxParameters[auxParameters.count() - 1]; | - |
907 | | - |
908 | if (!QDBusMetaType::demarshall(in, out.userType(), out.data())) partially evaluated: !QDBusMetaType::demarshall(in, out.userType(), out.data()) no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
909 | qFatal("Internal error: demarshalling function for type '%s' (%d) failed!", never executed: QMessageLogger("qdbusintegrator.cpp", 909, __PRETTY_FUNCTION__).fatal("Internal error: demarshalling function for type '%s' (%d) failed!", out.typeName(), out.userType()); | 0 |
910 | out.typeName(), out.userType()); never executed: QMessageLogger("qdbusintegrator.cpp", 909, __PRETTY_FUNCTION__).fatal("Internal error: demarshalling function for type '%s' (%d) failed!", out.typeName(), out.userType()); | 0 |
911 | | - |
912 | params.append(const_cast<void *>(out.constData())); executed (the execution status of this line is deduced): params.append(const_cast<void *>(out.constData())); | - |
913 | } else { executed: } Execution Count:13 | 13 |
914 | qFatal("Internal error: got invalid meta type %d (%s) " never executed (the execution status of this line is deduced): QMessageLogger("qdbusintegrator.cpp", 914, __PRETTY_FUNCTION__).fatal("Internal error: got invalid meta type %d (%s) " | - |
915 | "when trying to convert to meta type %d (%s)", never executed (the execution status of this line is deduced): "when trying to convert to meta type %d (%s)", | - |
916 | arg.userType(), QMetaType::typeName(arg.userType()), never executed (the execution status of this line is deduced): arg.userType(), QMetaType::typeName(arg.userType()), | - |
917 | id, QMetaType::typeName(id)); never executed (the execution status of this line is deduced): id, QMetaType::typeName(id)); | - |
918 | } | 0 |
919 | } | - |
920 | | - |
921 | if (metaTypes.count() > i && metaTypes[i] == QDBusMetaTypeId::message()) { evaluated: metaTypes.count() > i yes Evaluation Count:130 | yes Evaluation Count:265 |
evaluated: metaTypes[i] == QDBusMetaTypeId::message() yes Evaluation Count:124 | yes Evaluation Count:6 |
| 6-265 |
922 | params.append(const_cast<void*>(static_cast<const void*>(&msg))); executed (the execution status of this line is deduced): params.append(const_cast<void*>(static_cast<const void*>(&msg))); | - |
923 | ++i; executed (the execution status of this line is deduced): ++i; | - |
924 | } executed: } Execution Count:124 | 124 |
925 | | - |
926 | // output arguments | - |
927 | QVariantList outputArgs; executed (the execution status of this line is deduced): QVariantList outputArgs; | - |
928 | void *null = 0; executed (the execution status of this line is deduced): void *null = 0; | - |
929 | if (metaTypes[0] != QMetaType::Void && metaTypes[0] != QMetaType::UnknownType) { evaluated: metaTypes[0] != QMetaType::Void yes Evaluation Count:241 | yes Evaluation Count:154 |
evaluated: metaTypes[0] != QMetaType::UnknownType yes Evaluation Count:122 | yes Evaluation Count:119 |
| 119-241 |
930 | QVariant arg(metaTypes[0], null); executed (the execution status of this line is deduced): QVariant arg(metaTypes[0], null); | - |
931 | outputArgs.append( arg ); executed (the execution status of this line is deduced): outputArgs.append( arg ); | - |
932 | params[0] = const_cast<void*>(outputArgs.at( outputArgs.count() - 1 ).constData()); executed (the execution status of this line is deduced): params[0] = const_cast<void*>(outputArgs.at( outputArgs.count() - 1 ).constData()); | - |
933 | } executed: } Execution Count:122 | 122 |
934 | for ( ; i < metaTypes.count(); ++i) { evaluated: i < metaTypes.count() yes Evaluation Count:7 | yes Evaluation Count:395 |
| 7-395 |
935 | QVariant arg(metaTypes[i], null); executed (the execution status of this line is deduced): QVariant arg(metaTypes[i], null); | - |
936 | outputArgs.append( arg ); executed (the execution status of this line is deduced): outputArgs.append( arg ); | - |
937 | params.append(const_cast<void*>(outputArgs.at( outputArgs.count() - 1 ).constData())); executed (the execution status of this line is deduced): params.append(const_cast<void*>(outputArgs.at( outputArgs.count() - 1 ).constData())); | - |
938 | } executed: } Execution Count:7 | 7 |
939 | | - |
940 | // make call: | - |
941 | bool fail; executed (the execution status of this line is deduced): bool fail; | - |
942 | if (!object) { partially evaluated: !object no Evaluation Count:0 | yes Evaluation Count:395 |
| 0-395 |
943 | fail = true; never executed (the execution status of this line is deduced): fail = true; | - |
944 | } else { | 0 |
945 | // FIXME: save the old sender! | - |
946 | QDBusContextPrivate context(QDBusConnection(this), msg); executed (the execution status of this line is deduced): QDBusContextPrivate context(QDBusConnection(this), msg); | - |
947 | QDBusContextPrivate *old = QDBusContextPrivate::set(object, &context); executed (the execution status of this line is deduced): QDBusContextPrivate *old = QDBusContextPrivate::set(object, &context); | - |
948 | QDBusConnectionPrivate::setSender(this); executed (the execution status of this line is deduced): QDBusConnectionPrivate::setSender(this); | - |
949 | | - |
950 | QPointer<QObject> ptr = object; executed (the execution status of this line is deduced): QPointer<QObject> ptr = object; | - |
951 | fail = object->qt_metacall(QMetaObject::InvokeMetaMethod, executed (the execution status of this line is deduced): fail = object->qt_metacall(QMetaObject::InvokeMetaMethod, | - |
952 | slotIdx, params.data()) >= 0; executed (the execution status of this line is deduced): slotIdx, params.data()) >= 0; | - |
953 | QDBusConnectionPrivate::setSender(0); executed (the execution status of this line is deduced): QDBusConnectionPrivate::setSender(0); | - |
954 | // the object might be deleted in the slot | - |
955 | if (!ptr.isNull()) partially evaluated: !ptr.isNull() yes Evaluation Count:395 | no Evaluation Count:0 |
| 0-395 |
956 | QDBusContextPrivate::set(object, old); executed: QDBusContextPrivate::set(object, old); Execution Count:395 | 395 |
957 | } executed: } Execution Count:395 | 395 |
958 | | - |
959 | // do we create a reply? Only if the caller is waiting for a reply and one hasn't been sent | - |
960 | // yet. | - |
961 | if (msg.isReplyRequired() && !msg.isDelayedReply()) { evaluated: msg.isReplyRequired() yes Evaluation Count:241 | yes Evaluation Count:154 |
evaluated: !msg.isDelayedReply() yes Evaluation Count:223 | yes Evaluation Count:18 |
| 18-241 |
962 | if (!fail) { partially evaluated: !fail yes Evaluation Count:223 | no Evaluation Count:0 |
| 0-223 |
963 | // normal reply | - |
964 | qDBusDebug() << this << "Automatically sending reply:" << outputArgs; executed: ; Execution Count:223 never executed: QMessageLogger("qdbusintegrator.cpp", 964, __PRETTY_FUNCTION__).debug() << this << "Automatically sending reply:" << outputArgs; partially evaluated: !::isDebugging yes Evaluation Count:223 | no Evaluation Count:0 |
| 0-223 |
965 | send(msg.createReply(outputArgs)); executed (the execution status of this line is deduced): send(msg.createReply(outputArgs)); | - |
966 | } else { executed: } Execution Count:223 | 223 |
967 | // generate internal error | - |
968 | qWarning("Internal error: Failed to deliver message"); never executed (the execution status of this line is deduced): QMessageLogger("qdbusintegrator.cpp", 968, __PRETTY_FUNCTION__).warning("Internal error: Failed to deliver message"); | - |
969 | send(msg.createErrorReply(QDBusError::InternalError, never executed (the execution status of this line is deduced): send(msg.createErrorReply(QDBusError::InternalError, | - |
970 | QLatin1String("Failed to deliver message"))); never executed (the execution status of this line is deduced): QLatin1String("Failed to deliver message"))); | - |
971 | } | 0 |
972 | } | - |
973 | | - |
974 | return; executed: return; Execution Count:395 | 395 |
975 | } | - |
976 | | - |
977 | extern bool qDBusInitThreads(); | - |
978 | | - |
979 | QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) | - |
980 | : QObject(p), ref(1), capabilities(0), mode(InvalidMode), connection(0), server(0), busService(0), | - |
981 | watchAndTimeoutLock(QMutex::Recursive), | - |
982 | rootNode(QString(QLatin1Char('/'))) | - |
983 | { | - |
984 | static const bool threads = q_dbus_threads_init_default(); | - |
985 | static const int debugging = qgetenv("QDBUS_DEBUG").toInt(); | - |
986 | ::isDebugging = debugging; executed (the execution status of this line is deduced): ::isDebugging = debugging; | - |
987 | Q_UNUSED(threads) executed (the execution status of this line is deduced): (void)threads; | - |
988 | Q_UNUSED(debugging) executed (the execution status of this line is deduced): (void)debugging; | - |
989 | | - |
990 | #ifdef QDBUS_THREAD_DEBUG | - |
991 | if (debugging > 1) | - |
992 | qdbusThreadDebug = qdbusDefaultThreadDebug; | - |
993 | #endif | - |
994 | | - |
995 | QDBusMetaTypeId::init(); executed (the execution status of this line is deduced): QDBusMetaTypeId::init(); | - |
996 | | - |
997 | rootNode.flags = 0; executed (the execution status of this line is deduced): rootNode.flags = 0; | - |
998 | | - |
999 | // prepopulate watchedServices: | - |
1000 | // we know that the owner of org.freedesktop.DBus is itself | - |
1001 | watchedServices.insert(dbusServiceString(), WatchedServiceData(dbusServiceString(), 1)); executed (the execution status of this line is deduced): watchedServices.insert(dbusServiceString(), WatchedServiceData(dbusServiceString(), 1)); | - |
1002 | | - |
1003 | // prepopulate matchRefCounts: | - |
1004 | // we know that org.freedesktop.DBus will never change owners | - |
1005 | matchRefCounts.insert("type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.DBus'", 1); executed (the execution status of this line is deduced): matchRefCounts.insert("type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.DBus'", 1); | - |
1006 | } executed: } Execution Count:178 | 178 |
1007 | | - |
1008 | QDBusConnectionPrivate::~QDBusConnectionPrivate() | - |
1009 | { | - |
1010 | if (thread() && thread() != QThread::currentThread()) evaluated: thread() yes Evaluation Count:176 | yes Evaluation Count:1 |
partially evaluated: thread() != QThread::currentThread() no Evaluation Count:0 | yes Evaluation Count:176 |
| 0-176 |
1011 | qWarning("QDBusConnection(name=\"%s\")'s last reference in not in its creation thread! " never executed: QMessageLogger("qdbusintegrator.cpp", 1011, __PRETTY_FUNCTION__).warning("QDBusConnection(name=\"%s\")'s last reference in not in its creation thread! " "Timer and socket errors will follow and the program will probably crash", QString(name).toLocal8Bit().constData()); | 0 |
1012 | "Timer and socket errors will follow and the program will probably crash", never executed: QMessageLogger("qdbusintegrator.cpp", 1011, __PRETTY_FUNCTION__).warning("QDBusConnection(name=\"%s\")'s last reference in not in its creation thread! " "Timer and socket errors will follow and the program will probably crash", QString(name).toLocal8Bit().constData()); | 0 |
1013 | qPrintable(name)); never executed: QMessageLogger("qdbusintegrator.cpp", 1011, __PRETTY_FUNCTION__).warning("QDBusConnection(name=\"%s\")'s last reference in not in its creation thread! " "Timer and socket errors will follow and the program will probably crash", QString(name).toLocal8Bit().constData()); | 0 |
1014 | | - |
1015 | closeConnection(); executed (the execution status of this line is deduced): closeConnection(); | - |
1016 | rootNode.children.clear(); // free resources executed (the execution status of this line is deduced): rootNode.children.clear(); | - |
1017 | qDeleteAll(cachedMetaObjects); executed (the execution status of this line is deduced): qDeleteAll(cachedMetaObjects); | - |
1018 | | - |
1019 | if (server) evaluated: server yes Evaluation Count:8 | yes Evaluation Count:169 |
| 8-169 |
1020 | q_dbus_server_unref(server); executed: q_dbus_server_unref(server); Execution Count:8 | 8 |
1021 | if (connection) evaluated: connection yes Evaluation Count:164 | yes Evaluation Count:13 |
| 13-164 |
1022 | q_dbus_connection_unref(connection); executed: q_dbus_connection_unref(connection); Execution Count:164 | 164 |
1023 | | - |
1024 | connection = 0; executed (the execution status of this line is deduced): connection = 0; | - |
1025 | server = 0; executed (the execution status of this line is deduced): server = 0; | - |
1026 | } executed: } Execution Count:177 | 177 |
1027 | | - |
1028 | void QDBusConnectionPrivate::deleteYourself() | - |
1029 | { | - |
1030 | if (thread() && thread() != QThread::currentThread()) { evaluated: thread() yes Evaluation Count:169 | yes Evaluation Count:1 |
evaluated: thread() != QThread::currentThread() yes Evaluation Count:2 | yes Evaluation Count:167 |
| 1-169 |
1031 | // last reference dropped while not in the correct thread | - |
1032 | // ask the correct thread to delete | - |
1033 | | - |
1034 | // note: since we're posting an event to another thread, we | - |
1035 | // must consider deleteLater() to take effect immediately | - |
1036 | deleteLater(); executed (the execution status of this line is deduced): deleteLater(); | - |
1037 | } else { executed: } Execution Count:2 | 2 |
1038 | delete this; executed (the execution status of this line is deduced): delete this; | - |
1039 | } executed: } Execution Count:168 | 168 |
1040 | } | - |
1041 | | - |
1042 | void QDBusConnectionPrivate::closeConnection() | - |
1043 | { | - |
1044 | QDBusWriteLocker locker(CloseConnectionAction, this); executed (the execution status of this line is deduced): QDBusWriteLocker locker(CloseConnectionAction, this); | - |
1045 | ConnectionMode oldMode = mode; executed (the execution status of this line is deduced): ConnectionMode oldMode = mode; | - |
1046 | mode = InvalidMode; // prevent reentrancy executed (the execution status of this line is deduced): mode = InvalidMode; | - |
1047 | baseService.clear(); executed (the execution status of this line is deduced): baseService.clear(); | - |
1048 | | - |
1049 | if (server) evaluated: server yes Evaluation Count:8 | yes Evaluation Count:169 |
| 8-169 |
1050 | q_dbus_server_disconnect(server); executed: q_dbus_server_disconnect(server); Execution Count:8 | 8 |
1051 | | - |
1052 | if (oldMode == ClientMode || oldMode == PeerMode) { evaluated: oldMode == ClientMode yes Evaluation Count:22 | yes Evaluation Count:155 |
evaluated: oldMode == PeerMode yes Evaluation Count:142 | yes Evaluation Count:13 |
| 13-155 |
1053 | if (connection) { partially evaluated: connection yes Evaluation Count:164 | no Evaluation Count:0 |
| 0-164 |
1054 | q_dbus_connection_close(connection); executed (the execution status of this line is deduced): q_dbus_connection_close(connection); | - |
1055 | // send the "close" message | - |
1056 | while (q_dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS) evaluated: q_dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS yes Evaluation Count:7 | yes Evaluation Count:164 |
| 7-164 |
1057 | ; executed: ; Execution Count:7 | 7 |
1058 | } executed: } Execution Count:164 | 164 |
1059 | } executed: } Execution Count:164 | 164 |
1060 | qDBusDebug() << this << "Disconnected"; executed: ; Execution Count:177 never executed: QMessageLogger("qdbusintegrator.cpp", 1060, __PRETTY_FUNCTION__).debug() << this << "Disconnected"; partially evaluated: !::isDebugging yes Evaluation Count:177 | no Evaluation Count:0 |
| 0-177 |
1061 | } | - |
1062 | | - |
1063 | void QDBusConnectionPrivate::checkThread() | - |
1064 | { | - |
1065 | if (!thread()) { evaluated: !thread() yes Evaluation Count:1 | yes Evaluation Count:1960 |
| 1-1960 |
1066 | if (QCoreApplication::instance()) partially evaluated: QCoreApplication::instance() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1067 | moveToThread(QCoreApplication::instance()->thread()); executed: moveToThread(QCoreApplication::instance()->thread()); Execution Count:1 | 1 |
1068 | else | - |
1069 | qWarning("The thread that had QDBusConnection('%s') has died and there is no main thread", never executed: QMessageLogger("qdbusintegrator.cpp", 1069, __PRETTY_FUNCTION__).warning("The thread that had QDBusConnection('%s') has died and there is no main thread", QString(name).toLocal8Bit().constData()); | 0 |
1070 | qPrintable(name)); never executed: QMessageLogger("qdbusintegrator.cpp", 1069, __PRETTY_FUNCTION__).warning("The thread that had QDBusConnection('%s') has died and there is no main thread", QString(name).toLocal8Bit().constData()); | 0 |
1071 | } | - |
1072 | } executed: } Execution Count:1961 | 1961 |
1073 | | - |
1074 | bool QDBusConnectionPrivate::handleError(const QDBusErrorInternal &error) | - |
1075 | { | - |
1076 | if (!error) partially evaluated: !error no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1077 | return false; // no error never executed: return false; | 0 |
1078 | | - |
1079 | //lock.lockForWrite(); | - |
1080 | lastError = error; executed (the execution status of this line is deduced): lastError = error; | - |
1081 | //lock.unlock(); | - |
1082 | return true; executed: return true; Execution Count:5 | 5 |
1083 | } | - |
1084 | | - |
1085 | void QDBusConnectionPrivate::timerEvent(QTimerEvent *e) | - |
1086 | { | - |
1087 | { | - |
1088 | QDBusWatchAndTimeoutLocker locker(TimerEventAction, this); never executed (the execution status of this line is deduced): QDBusWatchAndTimeoutLocker locker(TimerEventAction, this); | - |
1089 | DBusTimeout *timeout = timeouts.value(e->timerId(), 0); never executed (the execution status of this line is deduced): DBusTimeout *timeout = timeouts.value(e->timerId(), 0); | - |
1090 | if (timeout) | 0 |
1091 | q_dbus_timeout_handle(timeout); never executed: q_dbus_timeout_handle(timeout); | 0 |
1092 | } | - |
1093 | | - |
1094 | doDispatch(); never executed (the execution status of this line is deduced): doDispatch(); | - |
1095 | } | 0 |
1096 | | - |
1097 | void QDBusConnectionPrivate::customEvent(QEvent *e) | - |
1098 | { | - |
1099 | Q_ASSERT(e->type() == QEvent::User); executed (the execution status of this line is deduced): qt_noop(); | - |
1100 | | - |
1101 | QDBusConnectionCallbackEvent *ev = static_cast<QDBusConnectionCallbackEvent *>(e); executed (the execution status of this line is deduced): QDBusConnectionCallbackEvent *ev = static_cast<QDBusConnectionCallbackEvent *>(e); | - |
1102 | QDBusLockerBase::reportThreadAction(int(AddTimeoutAction) + int(ev->subtype), executed (the execution status of this line is deduced): QDBusLockerBase::reportThreadAction(int(AddTimeoutAction) + int(ev->subtype), | - |
1103 | QDBusLockerBase::BeforeDeliver, this); executed (the execution status of this line is deduced): QDBusLockerBase::BeforeDeliver, this); | - |
1104 | switch (ev->subtype) | - |
1105 | { | - |
1106 | case QDBusConnectionCallbackEvent::AddTimeout: { | - |
1107 | QDBusWatchAndTimeoutLocker locker(RealAddTimeoutAction, this); executed (the execution status of this line is deduced): QDBusWatchAndTimeoutLocker locker(RealAddTimeoutAction, this); | - |
1108 | while (!timeoutsPendingAdd.isEmpty()) { evaluated: !timeoutsPendingAdd.isEmpty() yes Evaluation Count:4 | yes Evaluation Count:5 |
| 4-5 |
1109 | QPair<DBusTimeout *, int> entry = timeoutsPendingAdd.takeFirst(); executed (the execution status of this line is deduced): QPair<DBusTimeout *, int> entry = timeoutsPendingAdd.takeFirst(); | - |
1110 | qDBusRealAddTimeout(this, entry.first, entry.second); executed (the execution status of this line is deduced): qDBusRealAddTimeout(this, entry.first, entry.second); | - |
1111 | } executed: } Execution Count:4 | 4 |
1112 | break; executed: break; Execution Count:5 | 5 |
1113 | } | - |
1114 | | - |
1115 | case QDBusConnectionCallbackEvent::KillTimer: | - |
1116 | killTimer(ev->timerId); never executed (the execution status of this line is deduced): killTimer(ev->timerId); | - |
1117 | break; | 0 |
1118 | | - |
1119 | case QDBusConnectionCallbackEvent::AddWatch: | - |
1120 | qDBusRealAddWatch(this, ev->watch, ev->extra, ev->fd); never executed (the execution status of this line is deduced): qDBusRealAddWatch(this, ev->watch, ev->extra, ev->fd); | - |
1121 | break; | 0 |
1122 | | - |
1123 | case QDBusConnectionCallbackEvent::ToggleWatch: | - |
1124 | qDBusRealToggleWatch(this, ev->watch, ev->fd); never executed (the execution status of this line is deduced): qDBusRealToggleWatch(this, ev->watch, ev->fd); | - |
1125 | break; | 0 |
1126 | } | - |
1127 | QDBusLockerBase::reportThreadAction(int(AddTimeoutAction) + int(ev->subtype), executed (the execution status of this line is deduced): QDBusLockerBase::reportThreadAction(int(AddTimeoutAction) + int(ev->subtype), | - |
1128 | QDBusLockerBase::AfterDeliver, this); executed (the execution status of this line is deduced): QDBusLockerBase::AfterDeliver, this); | - |
1129 | } executed: } Execution Count:5 | 5 |
1130 | | - |
1131 | void QDBusConnectionPrivate::doDispatch() | - |
1132 | { | - |
1133 | QDBusDispatchLocker locker(DoDispatchAction, this); executed (the execution status of this line is deduced): QDBusDispatchLocker locker(DoDispatchAction, this); | - |
1134 | if (mode == ClientMode || mode == PeerMode) evaluated: mode == ClientMode yes Evaluation Count:190 | yes Evaluation Count:658 |
evaluated: mode == PeerMode yes Evaluation Count:641 | yes Evaluation Count:17 |
| 17-658 |
1135 | while (q_dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS) ; executed: ; Execution Count:30 evaluated: q_dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS yes Evaluation Count:30 | yes Evaluation Count:831 |
| 30-831 |
1136 | } executed: } Execution Count:848 | 848 |
1137 | | - |
1138 | void QDBusConnectionPrivate::socketRead(int fd) | - |
1139 | { | - |
1140 | QVarLengthArray<DBusWatch *, 2> pendingWatches; executed (the execution status of this line is deduced): QVarLengthArray<DBusWatch *, 2> pendingWatches; | - |
1141 | | - |
1142 | { | - |
1143 | QDBusWatchAndTimeoutLocker locker(SocketReadAction, this); executed (the execution status of this line is deduced): QDBusWatchAndTimeoutLocker locker(SocketReadAction, this); | - |
1144 | WatcherHash::ConstIterator it = watchers.constFind(fd); executed (the execution status of this line is deduced): WatcherHash::ConstIterator it = watchers.constFind(fd); | - |
1145 | while (it != watchers.constEnd() && it.key() == fd) { evaluated: it != watchers.constEnd() yes Evaluation Count:823 | yes Evaluation Count:420 |
partially evaluated: it.key() == fd yes Evaluation Count:823 | no Evaluation Count:0 |
| 0-823 |
1146 | if (it->watch && it->read && it->read->isEnabled()) partially evaluated: it->watch yes Evaluation Count:823 | no Evaluation Count:0 |
evaluated: it->read yes Evaluation Count:420 | yes Evaluation Count:403 |
partially evaluated: it->read->isEnabled() yes Evaluation Count:420 | no Evaluation Count:0 |
| 0-823 |
1147 | pendingWatches.append(it.value().watch); executed: pendingWatches.append(it.value().watch); Execution Count:420 | 420 |
1148 | ++it; executed (the execution status of this line is deduced): ++it; | - |
1149 | } executed: } Execution Count:823 | 823 |
1150 | } | - |
1151 | | - |
1152 | for (int i = 0; i < pendingWatches.size(); ++i) evaluated: i < pendingWatches.size() yes Evaluation Count:420 | yes Evaluation Count:420 |
| 420 |
1153 | if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_READABLE)) partially evaluated: !q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_READABLE) no Evaluation Count:0 | yes Evaluation Count:420 |
| 0-420 |
1154 | qDebug("OUT OF MEM"); never executed: QMessageLogger("qdbusintegrator.cpp", 1154, __PRETTY_FUNCTION__).debug("OUT OF MEM"); | 0 |
1155 | doDispatch(); executed (the execution status of this line is deduced): doDispatch(); | - |
1156 | } executed: } Execution Count:420 | 420 |
1157 | | - |
1158 | void QDBusConnectionPrivate::socketWrite(int fd) | - |
1159 | { | - |
1160 | QVarLengthArray<DBusWatch *, 2> pendingWatches; executed (the execution status of this line is deduced): QVarLengthArray<DBusWatch *, 2> pendingWatches; | - |
1161 | | - |
1162 | { | - |
1163 | QDBusWatchAndTimeoutLocker locker(SocketWriteAction, this); executed (the execution status of this line is deduced): QDBusWatchAndTimeoutLocker locker(SocketWriteAction, this); | - |
1164 | WatcherHash::ConstIterator it = watchers.constFind(fd); executed (the execution status of this line is deduced): WatcherHash::ConstIterator it = watchers.constFind(fd); | - |
1165 | while (it != watchers.constEnd() && it.key() == fd) { evaluated: it != watchers.constEnd() yes Evaluation Count:156 | yes Evaluation Count:78 |
partially evaluated: it.key() == fd yes Evaluation Count:156 | no Evaluation Count:0 |
| 0-156 |
1166 | if (it->watch && it->write && it->write->isEnabled()) partially evaluated: it->watch yes Evaluation Count:156 | no Evaluation Count:0 |
evaluated: it->write yes Evaluation Count:78 | yes Evaluation Count:78 |
partially evaluated: it->write->isEnabled() yes Evaluation Count:78 | no Evaluation Count:0 |
| 0-156 |
1167 | pendingWatches.append(it.value().watch); executed: pendingWatches.append(it.value().watch); Execution Count:78 | 78 |
1168 | ++it; executed (the execution status of this line is deduced): ++it; | - |
1169 | } executed: } Execution Count:156 | 156 |
1170 | } | - |
1171 | | - |
1172 | for (int i = 0; i < pendingWatches.size(); ++i) evaluated: i < pendingWatches.size() yes Evaluation Count:78 | yes Evaluation Count:78 |
| 78 |
1173 | if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_WRITABLE)) partially evaluated: !q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_WRITABLE) no Evaluation Count:0 | yes Evaluation Count:78 |
| 0-78 |
1174 | qDebug("OUT OF MEM"); never executed: QMessageLogger("qdbusintegrator.cpp", 1174, __PRETTY_FUNCTION__).debug("OUT OF MEM"); | 0 |
1175 | } executed: } Execution Count:78 | 78 |
1176 | | - |
1177 | void QDBusConnectionPrivate::objectDestroyed(QObject *obj) | - |
1178 | { | - |
1179 | QDBusWriteLocker locker(ObjectDestroyedAction, this); executed (the execution status of this line is deduced): QDBusWriteLocker locker(ObjectDestroyedAction, this); | - |
1180 | huntAndDestroy(obj, rootNode); executed (the execution status of this line is deduced): huntAndDestroy(obj, rootNode); | - |
1181 | | - |
1182 | SignalHookHash::iterator sit = signalHooks.begin(); executed (the execution status of this line is deduced): SignalHookHash::iterator sit = signalHooks.begin(); | - |
1183 | while (sit != signalHooks.end()) { evaluated: sit != signalHooks.end() yes Evaluation Count:638 | yes Evaluation Count:195 |
| 195-638 |
1184 | if (static_cast<QObject *>(sit.value().obj) == obj) evaluated: static_cast<QObject *>(sit.value().obj) == obj yes Evaluation Count:178 | yes Evaluation Count:460 |
| 178-460 |
1185 | sit = disconnectSignal(sit); executed: sit = disconnectSignal(sit); Execution Count:178 | 178 |
1186 | else | - |
1187 | ++sit; executed: ++sit; Execution Count:460 | 460 |
1188 | } | - |
1189 | | - |
1190 | obj->disconnect(this); executed (the execution status of this line is deduced): obj->disconnect(this); | - |
1191 | } executed: } Execution Count:195 | 195 |
1192 | | - |
1193 | void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, int signalId, | - |
1194 | const QVariantList &args) | - |
1195 | { | - |
1196 | QString interface = qDBusInterfaceFromMetaObject(mo); executed (the execution status of this line is deduced): QString interface = qDBusInterfaceFromMetaObject(mo); | - |
1197 | | - |
1198 | QMetaMethod mm = mo->method(signalId); executed (the execution status of this line is deduced): QMetaMethod mm = mo->method(signalId); | - |
1199 | QByteArray memberName = mm.name(); executed (the execution status of this line is deduced): QByteArray memberName = mm.name(); | - |
1200 | | - |
1201 | // check if it's scriptable | - |
1202 | bool isScriptable = mm.attributes() & QMetaMethod::Scriptable; executed (the execution status of this line is deduced): bool isScriptable = mm.attributes() & QMetaMethod::Scriptable; | - |
1203 | bool isAdaptor = false; executed (the execution status of this line is deduced): bool isAdaptor = false; | - |
1204 | for ( ; mo; mo = mo->superClass()) evaluated: mo yes Evaluation Count:184 | yes Evaluation Count:44 |
| 44-184 |
1205 | if (mo == &QDBusAbstractAdaptor::staticMetaObject) { evaluated: mo == &QDBusAbstractAdaptor::staticMetaObject yes Evaluation Count:48 | yes Evaluation Count:136 |
| 48-136 |
1206 | isAdaptor = true; executed (the execution status of this line is deduced): isAdaptor = true; | - |
1207 | break; executed: break; Execution Count:48 | 48 |
1208 | } | - |
1209 | | - |
1210 | QDBusReadLocker locker(RelaySignalAction, this); executed (the execution status of this line is deduced): QDBusReadLocker locker(RelaySignalAction, this); | - |
1211 | QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface, executed (the execution status of this line is deduced): QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface, | - |
1212 | QLatin1String(memberName)); executed (the execution status of this line is deduced): QLatin1String(memberName)); | - |
1213 | QDBusMessagePrivate::setParametersValidated(message, true); executed (the execution status of this line is deduced): QDBusMessagePrivate::setParametersValidated(message, true); | - |
1214 | message.setArguments(args); executed (the execution status of this line is deduced): message.setArguments(args); | - |
1215 | QDBusError error; executed (the execution status of this line is deduced): QDBusError error; | - |
1216 | DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error); executed (the execution status of this line is deduced): DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error); | - |
1217 | if (!msg) { partially evaluated: !msg no Evaluation Count:0 | yes Evaluation Count:92 |
| 0-92 |
1218 | qWarning("QDBusConnection: Could not emit signal %s.%s: %s", qPrintable(interface), memberName.constData(), never executed (the execution status of this line is deduced): QMessageLogger("qdbusintegrator.cpp", 1218, __PRETTY_FUNCTION__).warning("QDBusConnection: Could not emit signal %s.%s: %s", QString(interface).toLocal8Bit().constData(), memberName.constData(), | - |
1219 | qPrintable(error.message())); never executed (the execution status of this line is deduced): QString(error.message()).toLocal8Bit().constData()); | - |
1220 | lastError = error; never executed (the execution status of this line is deduced): lastError = error; | - |
1221 | return; | 0 |
1222 | } | - |
1223 | | - |
1224 | //qDBusDebug() << "Emitting signal" << message; | - |
1225 | //qDBusDebug() << "for paths:"; | - |
1226 | q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything executed (the execution status of this line is deduced): q_dbus_message_set_no_reply(msg, true); | - |
1227 | huntAndEmit(connection, msg, obj, rootNode, isScriptable, isAdaptor); executed (the execution status of this line is deduced): huntAndEmit(connection, msg, obj, rootNode, isScriptable, isAdaptor); | - |
1228 | q_dbus_message_unref(msg); executed (the execution status of this line is deduced): q_dbus_message_unref(msg); | - |
1229 | } executed: } Execution Count:92 | 92 |
1230 | | - |
1231 | void QDBusConnectionPrivate::serviceOwnerChangedNoLock(const QString &name, | - |
1232 | const QString &oldOwner, const QString &newOwner) | - |
1233 | { | - |
1234 | Q_UNUSED(oldOwner); executed (the execution status of this line is deduced): (void)oldOwner;; | - |
1235 | // QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this); | - |
1236 | WatchedServicesHash::Iterator it = watchedServices.find(name); executed (the execution status of this line is deduced): WatchedServicesHash::Iterator it = watchedServices.find(name); | - |
1237 | if (it == watchedServices.end()) evaluated: it == watchedServices.end() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
1238 | return; executed: return; Execution Count:2 | 2 |
1239 | if (oldOwner != it->owner) partially evaluated: oldOwner != it->owner no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1240 | qWarning("QDBusConnection: name '%s' had owner '%s' but we thought it was '%s'", never executed: QMessageLogger("qdbusintegrator.cpp", 1240, __PRETTY_FUNCTION__).warning("QDBusConnection: name '%s' had owner '%s' but we thought it was '%s'", QString(name).toLocal8Bit().constData(), QString(oldOwner).toLocal8Bit().constData(), QString(it->owner).toLocal8Bit().constData()); | 0 |
1241 | qPrintable(name), qPrintable(oldOwner), qPrintable(it->owner)); never executed: QMessageLogger("qdbusintegrator.cpp", 1240, __PRETTY_FUNCTION__).warning("QDBusConnection: name '%s' had owner '%s' but we thought it was '%s'", QString(name).toLocal8Bit().constData(), QString(oldOwner).toLocal8Bit().constData(), QString(it->owner).toLocal8Bit().constData()); | 0 |
1242 | | - |
1243 | qDBusDebug() << this << "Updating name" << name << "from" << oldOwner << "to" << newOwner; executed: ; Execution Count:2 never executed: QMessageLogger("qdbusintegrator.cpp", 1243, __PRETTY_FUNCTION__).debug() << this << "Updating name" << name << "from" << oldOwner << "to" << newOwner; partially evaluated: !::isDebugging yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1244 | it->owner = newOwner; executed (the execution status of this line is deduced): it->owner = newOwner; | - |
1245 | } executed: } Execution Count:2 | 2 |
1246 | | - |
1247 | int QDBusConnectionPrivate::findSlot(QObject* obj, const QByteArray &normalizedName, | - |
1248 | QVector<int> ¶ms) | - |
1249 | { | - |
1250 | int midx = obj->metaObject()->indexOfMethod(normalizedName); executed (the execution status of this line is deduced): int midx = obj->metaObject()->indexOfMethod(normalizedName); | - |
1251 | if (midx == -1) evaluated: midx == -1 yes Evaluation Count:4 | yes Evaluation Count:304 |
| 4-304 |
1252 | return -1; executed: return -1; Execution Count:4 | 4 |
1253 | | - |
1254 | int inputCount = qDBusParametersForMethod(obj->metaObject()->method(midx), params); executed (the execution status of this line is deduced): int inputCount = qDBusParametersForMethod(obj->metaObject()->method(midx), params); | - |
1255 | if ( inputCount == -1 || inputCount + 1 != params.count() ) partially evaluated: inputCount == -1 no Evaluation Count:0 | yes Evaluation Count:304 |
partially evaluated: inputCount + 1 != params.count() no Evaluation Count:0 | yes Evaluation Count:304 |
| 0-304 |
1256 | return -1; // failed to parse or invalid arguments or output arguments never executed: return -1; | 0 |
1257 | | - |
1258 | return midx; executed: return midx; Execution Count:304 | 304 |
1259 | } | - |
1260 | | - |
1261 | bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, | - |
1262 | const QString &service, | - |
1263 | const QString &path, const QString &interface, const QString &name, | - |
1264 | const QStringList &argMatch, | - |
1265 | QObject *receiver, const char *signal, int minMIdx, | - |
1266 | bool buildSignature) | - |
1267 | { | - |
1268 | QByteArray normalizedName = signal + 1; executed (the execution status of this line is deduced): QByteArray normalizedName = signal + 1; | - |
1269 | hook.midx = findSlot(receiver, signal + 1, hook.params); executed (the execution status of this line is deduced): hook.midx = findSlot(receiver, signal + 1, hook.params); | - |
1270 | if (hook.midx == -1) { evaluated: hook.midx == -1 yes Evaluation Count:2 | yes Evaluation Count:297 |
| 2-297 |
1271 | normalizedName = QMetaObject::normalizedSignature(signal + 1); executed (the execution status of this line is deduced): normalizedName = QMetaObject::normalizedSignature(signal + 1); | - |
1272 | hook.midx = findSlot(receiver, normalizedName, hook.params); executed (the execution status of this line is deduced): hook.midx = findSlot(receiver, normalizedName, hook.params); | - |
1273 | } executed: } Execution Count:2 | 2 |
1274 | if (hook.midx < minMIdx) { evaluated: hook.midx < minMIdx yes Evaluation Count:2 | yes Evaluation Count:297 |
| 2-297 |
1275 | if (hook.midx == -1) partially evaluated: hook.midx == -1 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1276 | {} executed: } Execution Count:2 | 2 |
1277 | return false; executed: return false; Execution Count:2 | 2 |
1278 | } | - |
1279 | | - |
1280 | hook.service = service; executed (the execution status of this line is deduced): hook.service = service; | - |
1281 | hook.path = path; executed (the execution status of this line is deduced): hook.path = path; | - |
1282 | hook.obj = receiver; executed (the execution status of this line is deduced): hook.obj = receiver; | - |
1283 | hook.argumentMatch = argMatch; executed (the execution status of this line is deduced): hook.argumentMatch = argMatch; | - |
1284 | | - |
1285 | // build the D-Bus signal name and signature | - |
1286 | // This should not happen for QDBusConnection::connect, use buildSignature here, since | - |
1287 | // QDBusConnection::connect passes false and everything else uses true | - |
1288 | QString mname = name; executed (the execution status of this line is deduced): QString mname = name; | - |
1289 | if (buildSignature && mname.isNull()) { evaluated: buildSignature yes Evaluation Count:87 | yes Evaluation Count:210 |
partially evaluated: mname.isNull() yes Evaluation Count:87 | no Evaluation Count:0 |
| 0-210 |
1290 | normalizedName.truncate(normalizedName.indexOf('(')); executed (the execution status of this line is deduced): normalizedName.truncate(normalizedName.indexOf('(')); | - |
1291 | mname = QString::fromUtf8(normalizedName); executed (the execution status of this line is deduced): mname = QString::fromUtf8(normalizedName); | - |
1292 | } executed: } Execution Count:87 | 87 |
1293 | key = mname; executed (the execution status of this line is deduced): key = mname; | - |
1294 | key.reserve(interface.length() + 1 + mname.length()); executed (the execution status of this line is deduced): key.reserve(interface.length() + 1 + mname.length()); | - |
1295 | key += QLatin1Char(':'); executed (the execution status of this line is deduced): key += QLatin1Char(':'); | - |
1296 | key += interface; executed (the execution status of this line is deduced): key += interface; | - |
1297 | | - |
1298 | if (buildSignature) { evaluated: buildSignature yes Evaluation Count:87 | yes Evaluation Count:210 |
| 87-210 |
1299 | hook.signature.clear(); executed (the execution status of this line is deduced): hook.signature.clear(); | - |
1300 | for (int i = 1; i < hook.params.count(); ++i) evaluated: i < hook.params.count() yes Evaluation Count:74 | yes Evaluation Count:87 |
| 74-87 |
1301 | if (hook.params.at(i) != QDBusMetaTypeId::message()) partially evaluated: hook.params.at(i) != QDBusMetaTypeId::message() yes Evaluation Count:74 | no Evaluation Count:0 |
| 0-74 |
1302 | hook.signature += QLatin1String( QDBusMetaType::typeToSignature( hook.params.at(i) ) ); executed: hook.signature += QLatin1String( QDBusMetaType::typeToSignature( hook.params.at(i) ) ); Execution Count:74 | 74 |
1303 | } executed: } Execution Count:87 | 87 |
1304 | | - |
1305 | hook.matchRule = buildMatchRule(service, path, interface, mname, argMatch, hook.signature); executed (the execution status of this line is deduced): hook.matchRule = buildMatchRule(service, path, interface, mname, argMatch, hook.signature); | - |
1306 | return true; // connect to this signal executed: return true; Execution Count:297 | 297 |
1307 | } | - |
1308 | | - |
1309 | void QDBusConnectionPrivate::sendError(const QDBusMessage &msg, QDBusError::ErrorType code) | - |
1310 | { | - |
1311 | if (code == QDBusError::UnknownMethod) { evaluated: code == QDBusError::UnknownMethod yes Evaluation Count:32 | yes Evaluation Count:67 |
| 32-67 |
1312 | QString interfaceMsg; executed (the execution status of this line is deduced): QString interfaceMsg; | - |
1313 | if (msg.interface().isEmpty()) evaluated: msg.interface().isEmpty() yes Evaluation Count:16 | yes Evaluation Count:16 |
| 16 |
1314 | interfaceMsg = QLatin1String("any interface"); executed: interfaceMsg = QLatin1String("any interface"); Execution Count:16 | 16 |
1315 | else | - |
1316 | interfaceMsg = QString::fromLatin1("interface '%1'").arg(msg.interface()); executed: interfaceMsg = QString::fromLatin1("interface '%1'").arg(msg.interface()); Execution Count:16 | 16 |
1317 | | - |
1318 | send(msg.createErrorReply(code, executed (the execution status of this line is deduced): send(msg.createErrorReply(code, | - |
1319 | QString::fromLatin1("No such method '%1' in %2 at object path '%3' " executed (the execution status of this line is deduced): QString::fromLatin1("No such method '%1' in %2 at object path '%3' " | - |
1320 | "(signature '%4')") executed (the execution status of this line is deduced): "(signature '%4')") | - |
1321 | .arg(msg.member(), interfaceMsg, msg.path(), msg.signature()))); executed (the execution status of this line is deduced): .arg(msg.member(), interfaceMsg, msg.path(), msg.signature()))); | - |
1322 | } else if (code == QDBusError::UnknownInterface) { executed: } Execution Count:32 evaluated: code == QDBusError::UnknownInterface yes Evaluation Count:1 | yes Evaluation Count:66 |
| 1-66 |
1323 | send(msg.createErrorReply(QDBusError::UnknownInterface, executed (the execution status of this line is deduced): send(msg.createErrorReply(QDBusError::UnknownInterface, | - |
1324 | QString::fromLatin1("No such interface '%1' at object path '%2'") executed (the execution status of this line is deduced): QString::fromLatin1("No such interface '%1' at object path '%2'") | - |
1325 | .arg(msg.interface(), msg.path()))); executed (the execution status of this line is deduced): .arg(msg.interface(), msg.path()))); | - |
1326 | } else if (code == QDBusError::UnknownObject) { executed: } Execution Count:1 partially evaluated: code == QDBusError::UnknownObject yes Evaluation Count:66 | no Evaluation Count:0 |
| 0-66 |
1327 | send(msg.createErrorReply(QDBusError::UnknownObject, executed (the execution status of this line is deduced): send(msg.createErrorReply(QDBusError::UnknownObject, | - |
1328 | QString::fromLatin1("No such object path '%1'").arg(msg.path()))); executed (the execution status of this line is deduced): QString::fromLatin1("No such object path '%1'").arg(msg.path()))); | - |
1329 | } executed: } Execution Count:66 | 66 |
1330 | } | - |
1331 | | - |
1332 | bool QDBusConnectionPrivate::activateInternalFilters(const ObjectTreeNode &node, | - |
1333 | const QDBusMessage &msg) | - |
1334 | { | - |
1335 | // object may be null | - |
1336 | const QString interface = msg.interface(); executed (the execution status of this line is deduced): const QString interface = msg.interface(); | - |
1337 | | - |
1338 | if (interface.isEmpty() || interface == QLatin1String(DBUS_INTERFACE_INTROSPECTABLE)) { evaluated: interface.isEmpty() yes Evaluation Count:95 | yes Evaluation Count:125 |
evaluated: interface == QLatin1String("org.freedesktop.DBus.Introspectable") yes Evaluation Count:55 | yes Evaluation Count:70 |
| 55-125 |
1339 | if (msg.member() == QLatin1String("Introspect") && msg.signature().isEmpty()) { evaluated: msg.member() == QLatin1String("Introspect") yes Evaluation Count:55 | yes Evaluation Count:95 |
partially evaluated: msg.signature().isEmpty() yes Evaluation Count:55 | no Evaluation Count:0 |
| 0-95 |
1340 | //qDebug() << "QDBusConnectionPrivate::activateInternalFilters introspect" << msg.d_ptr->msg; | - |
1341 | QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node, msg.path())); executed (the execution status of this line is deduced): QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node, msg.path())); | - |
1342 | send(reply); executed (the execution status of this line is deduced): send(reply); | - |
1343 | return true; executed: return true; Execution Count:55 | 55 |
1344 | } | - |
1345 | | - |
1346 | if (!interface.isEmpty()) { partially evaluated: !interface.isEmpty() no Evaluation Count:0 | yes Evaluation Count:95 |
| 0-95 |
1347 | sendError(msg, QDBusError::UnknownMethod); never executed (the execution status of this line is deduced): sendError(msg, QDBusError::UnknownMethod); | - |
1348 | return true; never executed: return true; | 0 |
1349 | } | - |
1350 | } executed: } Execution Count:95 | 95 |
1351 | | - |
1352 | if (node.obj && (interface.isEmpty() || evaluated: node.obj yes Evaluation Count:152 | yes Evaluation Count:13 |
evaluated: interface.isEmpty() yes Evaluation Count:82 | yes Evaluation Count:70 |
| 13-152 |
1353 | interface == QLatin1String(DBUS_INTERFACE_PROPERTIES))) { evaluated: interface == QLatin1String("org.freedesktop.DBus.Properties") yes Evaluation Count:41 | yes Evaluation Count:29 |
| 29-41 |
1354 | //qDebug() << "QDBusConnectionPrivate::activateInternalFilters properties" << msg.d_ptr->msg; | - |
1355 | if (msg.member() == QLatin1String("Get") && msg.signature() == QLatin1String("ss")) { evaluated: msg.member() == QLatin1String("Get") yes Evaluation Count:21 | yes Evaluation Count:102 |
partially evaluated: msg.signature() == QLatin1String("ss") yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-102 |
1356 | QDBusMessage reply = qDBusPropertyGet(node, msg); executed (the execution status of this line is deduced): QDBusMessage reply = qDBusPropertyGet(node, msg); | - |
1357 | send(reply); executed (the execution status of this line is deduced): send(reply); | - |
1358 | return true; executed: return true; Execution Count:21 | 21 |
1359 | } else if (msg.member() == QLatin1String("Set") && msg.signature() == QLatin1String("ssv")) { evaluated: msg.member() == QLatin1String("Set") yes Evaluation Count:14 | yes Evaluation Count:88 |
partially evaluated: msg.signature() == QLatin1String("ssv") yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-88 |
1360 | QDBusMessage reply = qDBusPropertySet(node, msg); executed (the execution status of this line is deduced): QDBusMessage reply = qDBusPropertySet(node, msg); | - |
1361 | send(reply); executed (the execution status of this line is deduced): send(reply); | - |
1362 | return true; executed: return true; Execution Count:14 | 14 |
1363 | } else if (msg.member() == QLatin1String("GetAll") && msg.signature() == QLatin1String("s")) { evaluated: msg.member() == QLatin1String("GetAll") yes Evaluation Count:6 | yes Evaluation Count:82 |
partially evaluated: msg.signature() == QLatin1String("s") yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-82 |
1364 | QDBusMessage reply = qDBusPropertyGetAll(node, msg); executed (the execution status of this line is deduced): QDBusMessage reply = qDBusPropertyGetAll(node, msg); | - |
1365 | send(reply); executed (the execution status of this line is deduced): send(reply); | - |
1366 | return true; executed: return true; Execution Count:6 | 6 |
1367 | } | - |
1368 | | - |
1369 | if (!interface.isEmpty()) { partially evaluated: !interface.isEmpty() no Evaluation Count:0 | yes Evaluation Count:82 |
| 0-82 |
1370 | sendError(msg, QDBusError::UnknownMethod); never executed (the execution status of this line is deduced): sendError(msg, QDBusError::UnknownMethod); | - |
1371 | return true; never executed: return true; | 0 |
1372 | } | - |
1373 | } executed: } Execution Count:82 | 82 |
1374 | | - |
1375 | return false; executed: return false; Execution Count:124 | 124 |
1376 | } | - |
1377 | | - |
1378 | void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMessage &msg, | - |
1379 | int pathStartPos) | - |
1380 | { | - |
1381 | // This is called by QDBusConnectionPrivate::handleObjectCall to place a call to a slot | - |
1382 | // on the object. | - |
1383 | // | - |
1384 | // The call is routed through the adaptor sub-objects if we have any | - |
1385 | | - |
1386 | // object may be null | - |
1387 | | - |
1388 | if (node.flags & QDBusConnectionPrivate::VirtualObject) { evaluated: node.flags & QDBusConnectionPrivate::VirtualObject yes Evaluation Count:7 | yes Evaluation Count:376 |
| 7-376 |
1389 | if (node.treeNode->handleMessage(msg, q(this))) { evaluated: node.treeNode->handleMessage(msg, q(this)) yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
1390 | return; executed: return; Execution Count:4 | 4 |
1391 | } else { | - |
1392 | if (activateInternalFilters(node, msg)) evaluated: activateInternalFilters(node, msg) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1393 | return; executed: return; Execution Count:2 | 2 |
1394 | } executed: } Execution Count:1 | 1 |
1395 | } | - |
1396 | | - |
1397 | if (pathStartPos != msg.path().length()) { evaluated: pathStartPos != msg.path().length() yes Evaluation Count:19 | yes Evaluation Count:358 |
| 19-358 |
1398 | node.flags &= ~QDBusConnection::ExportAllSignals; executed (the execution status of this line is deduced): node.flags &= ~QDBusConnection::ExportAllSignals; | - |
1399 | node.obj = findChildObject(&node, msg.path(), pathStartPos); executed (the execution status of this line is deduced): node.obj = findChildObject(&node, msg.path(), pathStartPos); | - |
1400 | if (!node.obj) { evaluated: !node.obj yes Evaluation Count:11 | yes Evaluation Count:8 |
| 8-11 |
1401 | sendError(msg, QDBusError::UnknownObject); executed (the execution status of this line is deduced): sendError(msg, QDBusError::UnknownObject); | - |
1402 | return; executed: return; Execution Count:11 | 11 |
1403 | } | - |
1404 | } executed: } Execution Count:8 | 8 |
1405 | | - |
1406 | QDBusAdaptorConnector *connector; executed (the execution status of this line is deduced): QDBusAdaptorConnector *connector; | - |
1407 | if (node.flags & QDBusConnection::ExportAdaptors && evaluated: node.flags & QDBusConnection::ExportAdaptors yes Evaluation Count:222 | yes Evaluation Count:144 |
| 144-222 |
1408 | (connector = qDBusFindAdaptorConnector(node.obj))) { partially evaluated: (connector = qDBusFindAdaptorConnector(node.obj)) yes Evaluation Count:222 | no Evaluation Count:0 |
| 0-222 |
1409 | int newflags = node.flags | QDBusConnection::ExportAllSlots; executed (the execution status of this line is deduced): int newflags = node.flags | QDBusConnection::ExportAllSlots; | - |
1410 | | - |
1411 | if (msg.interface().isEmpty()) { partially evaluated: msg.interface().isEmpty() no Evaluation Count:0 | yes Evaluation Count:222 |
| 0-222 |
1412 | // place the call in all interfaces | - |
1413 | // let the first one that handles it to work | - |
1414 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it = never executed (the execution status of this line is deduced): QDBusAdaptorConnector::AdaptorMap::ConstIterator it = | - |
1415 | connector->adaptors.constBegin(); never executed (the execution status of this line is deduced): connector->adaptors.constBegin(); | - |
1416 | QDBusAdaptorConnector::AdaptorMap::ConstIterator end = never executed (the execution status of this line is deduced): QDBusAdaptorConnector::AdaptorMap::ConstIterator end = | - |
1417 | connector->adaptors.constEnd(); never executed (the execution status of this line is deduced): connector->adaptors.constEnd(); | - |
1418 | | - |
1419 | for ( ; it != end; ++it) never evaluated: it != end | 0 |
1420 | if (activateCall(it->adaptor, newflags, msg)) never evaluated: activateCall(it->adaptor, newflags, msg) | 0 |
1421 | return; | 0 |
1422 | } else { | 0 |
1423 | // check if we have an interface matching the name that was asked: | - |
1424 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; executed (the execution status of this line is deduced): QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - |
1425 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), executed (the execution status of this line is deduced): it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - |
1426 | msg.interface()); executed (the execution status of this line is deduced): msg.interface()); | - |
1427 | if (it != connector->adaptors.constEnd() && msg.interface() == QLatin1String(it->interface)) { evaluated: it != connector->adaptors.constEnd() yes Evaluation Count:152 | yes Evaluation Count:70 |
evaluated: msg.interface() == QLatin1String(it->interface) yes Evaluation Count:149 | yes Evaluation Count:3 |
| 3-152 |
1428 | if (!activateCall(it->adaptor, newflags, msg)) evaluated: !activateCall(it->adaptor, newflags, msg) yes Evaluation Count:16 | yes Evaluation Count:133 |
| 16-133 |
1429 | sendError(msg, QDBusError::UnknownMethod); executed: sendError(msg, QDBusError::UnknownMethod); Execution Count:16 | 16 |
1430 | return; executed: return; Execution Count:149 | 149 |
1431 | } | - |
1432 | } executed: } Execution Count:73 | 73 |
1433 | } | - |
1434 | | - |
1435 | // no adaptors matched or were exported | - |
1436 | // try our standard filters | - |
1437 | if (activateInternalFilters(node, msg)) evaluated: activateInternalFilters(node, msg) yes Evaluation Count:94 | yes Evaluation Count:123 |
| 94-123 |
1438 | return; // internal filters have already run or an error has been sent executed: return; Execution Count:94 | 94 |
1439 | | - |
1440 | // try the object itself: | - |
1441 | if (node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots) || evaluated: node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots) yes Evaluation Count:109 | yes Evaluation Count:14 |
| 14-109 |
1442 | node.flags & (QDBusConnection::ExportScriptableInvokables|QDBusConnection::ExportNonScriptableInvokables)) { partially evaluated: node.flags & (QDBusConnection::ExportScriptableInvokables|QDBusConnection::ExportNonScriptableInvokables) no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
1443 | bool interfaceFound = true; executed (the execution status of this line is deduced): bool interfaceFound = true; | - |
1444 | if (!msg.interface().isEmpty()) evaluated: !msg.interface().isEmpty() yes Evaluation Count:28 | yes Evaluation Count:81 |
| 28-81 |
1445 | interfaceFound = qDBusInterfaceInObject(node.obj, msg.interface()); executed: interfaceFound = qDBusInterfaceInObject(node.obj, msg.interface()); Execution Count:28 | 28 |
1446 | | - |
1447 | if (interfaceFound) { partially evaluated: interfaceFound yes Evaluation Count:109 | no Evaluation Count:0 |
| 0-109 |
1448 | if (!activateCall(node.obj, node.flags, msg)) evaluated: !activateCall(node.obj, node.flags, msg) yes Evaluation Count:3 | yes Evaluation Count:106 |
| 3-106 |
1449 | sendError(msg, QDBusError::UnknownMethod); executed: sendError(msg, QDBusError::UnknownMethod); Execution Count:3 | 3 |
1450 | return; executed: return; Execution Count:109 | 109 |
1451 | } | - |
1452 | } | 0 |
1453 | | - |
1454 | // nothing matched, send an error code | - |
1455 | if (msg.interface().isEmpty()) evaluated: msg.interface().isEmpty() yes Evaluation Count:13 | yes Evaluation Count:1 |
| 1-13 |
1456 | sendError(msg, QDBusError::UnknownMethod); executed: sendError(msg, QDBusError::UnknownMethod); Execution Count:13 | 13 |
1457 | else | - |
1458 | sendError(msg, QDBusError::UnknownInterface); executed: sendError(msg, QDBusError::UnknownInterface); Execution Count:1 | 1 |
1459 | } | - |
1460 | | - |
1461 | void QDBusConnectionPrivate::handleObjectCall(const QDBusMessage &msg) | - |
1462 | { | - |
1463 | // if the msg is external, we were called from inside doDispatch | - |
1464 | // that means the dispatchLock mutex is locked | - |
1465 | // must not call out to user code in that case | - |
1466 | // | - |
1467 | // however, if the message is internal, handleMessage was called | - |
1468 | // directly and no lock is in place. We can therefore call out to | - |
1469 | // user code, if necessary | - |
1470 | ObjectTreeNode result; executed (the execution status of this line is deduced): ObjectTreeNode result; | - |
1471 | int usedLength; executed (the execution status of this line is deduced): int usedLength; | - |
1472 | QThread *objThread = 0; executed (the execution status of this line is deduced): QThread *objThread = 0; | - |
1473 | QSemaphore sem; executed (the execution status of this line is deduced): QSemaphore sem; | - |
1474 | bool semWait; executed (the execution status of this line is deduced): bool semWait; | - |
1475 | | - |
1476 | { | - |
1477 | QDBusReadLocker locker(HandleObjectCallAction, this); executed (the execution status of this line is deduced): QDBusReadLocker locker(HandleObjectCallAction, this); | - |
1478 | if (!findObject(&rootNode, msg.path(), usedLength, result)) { evaluated: !findObject(&rootNode, msg.path(), usedLength, result) yes Evaluation Count:55 | yes Evaluation Count:383 |
| 55-383 |
1479 | // qDebug("Call failed: no object found at %s", qPrintable(msg.path())); | - |
1480 | sendError(msg, QDBusError::UnknownObject); executed (the execution status of this line is deduced): sendError(msg, QDBusError::UnknownObject); | - |
1481 | return; executed: return; Execution Count:55 | 55 |
1482 | } | - |
1483 | | - |
1484 | if (!result.obj) { evaluated: !result.obj yes Evaluation Count:13 | yes Evaluation Count:370 |
| 13-370 |
1485 | // no object -> no threading issues | - |
1486 | // it's either going to be an error, or an internal filter | - |
1487 | activateObject(result, msg, usedLength); executed (the execution status of this line is deduced): activateObject(result, msg, usedLength); | - |
1488 | return; executed: return; Execution Count:13 | 13 |
1489 | } | - |
1490 | | - |
1491 | objThread = result.obj->thread(); executed (the execution status of this line is deduced): objThread = result.obj->thread(); | - |
1492 | if (!objThread) { partially evaluated: !objThread no Evaluation Count:0 | yes Evaluation Count:370 |
| 0-370 |
1493 | send(msg.createErrorReply(QDBusError::InternalError, never executed (the execution status of this line is deduced): send(msg.createErrorReply(QDBusError::InternalError, | - |
1494 | QString::fromLatin1("Object '%1' (at path '%2')" never executed (the execution status of this line is deduced): QString::fromLatin1("Object '%1' (at path '%2')" | - |
1495 | " has no thread. Cannot deliver message.") never executed (the execution status of this line is deduced): " has no thread. Cannot deliver message.") | - |
1496 | .arg(result.obj->objectName(), msg.path()))); never executed (the execution status of this line is deduced): .arg(result.obj->objectName(), msg.path()))); | - |
1497 | return; | 0 |
1498 | } | - |
1499 | | - |
1500 | if (!QDBusMessagePrivate::isLocal(msg)) { evaluated: !QDBusMessagePrivate::isLocal(msg) yes Evaluation Count:48 | yes Evaluation Count:322 |
| 48-322 |
1501 | // external incoming message | - |
1502 | // post it and forget | - |
1503 | postEventToThread(HandleObjectCallPostEventAction, result.obj, executed (the execution status of this line is deduced): postEventToThread(HandleObjectCallPostEventAction, result.obj, | - |
1504 | new QDBusActivateObjectEvent(QDBusConnection(this), this, result, executed (the execution status of this line is deduced): new QDBusActivateObjectEvent(QDBusConnection(this), this, result, | - |
1505 | usedLength, msg)); executed (the execution status of this line is deduced): usedLength, msg)); | - |
1506 | return; executed: return; Execution Count:48 | 48 |
1507 | } else if (objThread != QThread::currentThread()) { evaluated: objThread != QThread::currentThread() yes Evaluation Count:6 | yes Evaluation Count:316 |
| 6-316 |
1508 | // synchronize with other thread | - |
1509 | postEventToThread(HandleObjectCallPostEventAction, result.obj, executed (the execution status of this line is deduced): postEventToThread(HandleObjectCallPostEventAction, result.obj, | - |
1510 | new QDBusActivateObjectEvent(QDBusConnection(this), this, result, executed (the execution status of this line is deduced): new QDBusActivateObjectEvent(QDBusConnection(this), this, result, | - |
1511 | usedLength, msg, &sem)); executed (the execution status of this line is deduced): usedLength, msg, &sem)); | - |
1512 | semWait = true; executed (the execution status of this line is deduced): semWait = true; | - |
1513 | } else { executed: } Execution Count:6 | 6 |
1514 | semWait = false; executed (the execution status of this line is deduced): semWait = false; | - |
1515 | } executed: } Execution Count:316 | 316 |
1516 | } // release the lock | - |
1517 | | - |
1518 | if (semWait) evaluated: semWait yes Evaluation Count:6 | yes Evaluation Count:316 |
| 6-316 |
1519 | SEM_ACQUIRE(HandleObjectCallSemaphoreAction, sem); executed: sem.acquire(); Execution Count:6 | 6 |
1520 | else | - |
1521 | activateObject(result, msg, usedLength); executed: activateObject(result, msg, usedLength); Execution Count:316 | 316 |
1522 | } | - |
1523 | | - |
1524 | QDBusActivateObjectEvent::~QDBusActivateObjectEvent() | - |
1525 | { | - |
1526 | if (!handled) { partially evaluated: !handled no Evaluation Count:0 | yes Evaluation Count:54 |
| 0-54 |
1527 | // we're being destroyed without delivering | - |
1528 | // it means the object was deleted between posting and delivering | - |
1529 | QDBusConnectionPrivate *that = QDBusConnectionPrivate::d(connection); never executed (the execution status of this line is deduced): QDBusConnectionPrivate *that = QDBusConnectionPrivate::d(connection); | - |
1530 | that->sendError(message, QDBusError::UnknownObject); never executed (the execution status of this line is deduced): that->sendError(message, QDBusError::UnknownObject); | - |
1531 | } | 0 |
1532 | | - |
1533 | // semaphore releasing happens in ~QMetaCallEvent | - |
1534 | } executed: } Execution Count:54 | 54 |
1535 | | - |
1536 | void QDBusActivateObjectEvent::placeMetaCall(QObject *) | - |
1537 | { | - |
1538 | QDBusConnectionPrivate *that = QDBusConnectionPrivate::d(connection); executed (the execution status of this line is deduced): QDBusConnectionPrivate *that = QDBusConnectionPrivate::d(connection); | - |
1539 | | - |
1540 | QDBusLockerBase::reportThreadAction(HandleObjectCallPostEventAction, executed (the execution status of this line is deduced): QDBusLockerBase::reportThreadAction(HandleObjectCallPostEventAction, | - |
1541 | QDBusLockerBase::BeforeDeliver, that); executed (the execution status of this line is deduced): QDBusLockerBase::BeforeDeliver, that); | - |
1542 | that->activateObject(node, message, pathStartPos); executed (the execution status of this line is deduced): that->activateObject(node, message, pathStartPos); | - |
1543 | QDBusLockerBase::reportThreadAction(HandleObjectCallPostEventAction, executed (the execution status of this line is deduced): QDBusLockerBase::reportThreadAction(HandleObjectCallPostEventAction, | - |
1544 | QDBusLockerBase::AfterDeliver, that); executed (the execution status of this line is deduced): QDBusLockerBase::AfterDeliver, that); | - |
1545 | | - |
1546 | handled = true; executed (the execution status of this line is deduced): handled = true; | - |
1547 | } executed: } Execution Count:54 | 54 |
1548 | | - |
1549 | void QDBusConnectionPrivate::handleSignal(const QString &key, const QDBusMessage& msg) | - |
1550 | { | - |
1551 | SignalHookHash::const_iterator it = signalHooks.constFind(key); executed (the execution status of this line is deduced): SignalHookHash::const_iterator it = signalHooks.constFind(key); | - |
1552 | SignalHookHash::const_iterator end = signalHooks.constEnd(); executed (the execution status of this line is deduced): SignalHookHash::const_iterator end = signalHooks.constEnd(); | - |
1553 | //qDebug("looking for: %s", path.toLocal8Bit().constData()); | - |
1554 | //qDBusDebug() << signalHooks.keys(); | - |
1555 | for ( ; it != end && it.key() == key; ++it) { evaluated: it != end yes Evaluation Count:295 | yes Evaluation Count:502 |
evaluated: it.key() == key yes Evaluation Count:206 | yes Evaluation Count:89 |
| 89-502 |
1556 | const SignalHook &hook = it.value(); executed (the execution status of this line is deduced): const SignalHook &hook = it.value(); | - |
1557 | if (!hook.service.isEmpty()) { evaluated: !hook.service.isEmpty() yes Evaluation Count:145 | yes Evaluation Count:61 |
| 61-145 |
1558 | const QString owner = executed (the execution status of this line is deduced): const QString owner = | - |
1559 | shouldWatchService(hook.service) ? evaluated: shouldWatchService(hook.service) yes Evaluation Count:82 | yes Evaluation Count:63 |
| 63-82 |
1560 | watchedServices.value(hook.service).owner : executed (the execution status of this line is deduced): watchedServices.value(hook.service).owner : | - |
1561 | hook.service; executed (the execution status of this line is deduced): hook.service; | - |
1562 | if (owner != msg.service()) evaluated: owner != msg.service() yes Evaluation Count:2 | yes Evaluation Count:143 |
| 2-143 |
1563 | continue; executed: continue; Execution Count:2 | 2 |
1564 | } executed: } Execution Count:143 | 143 |
1565 | if (!hook.path.isEmpty() && hook.path != msg.path()) evaluated: !hook.path.isEmpty() yes Evaluation Count:124 | yes Evaluation Count:80 |
evaluated: hook.path != msg.path() yes Evaluation Count:11 | yes Evaluation Count:113 |
| 11-124 |
1566 | continue; executed: continue; Execution Count:11 | 11 |
1567 | if (!hook.signature.isEmpty() && hook.signature != msg.signature()) evaluated: !hook.signature.isEmpty() yes Evaluation Count:52 | yes Evaluation Count:141 |
evaluated: hook.signature != msg.signature() yes Evaluation Count:16 | yes Evaluation Count:36 |
| 16-141 |
1568 | continue; executed: continue; Execution Count:16 | 16 |
1569 | if (hook.signature.isEmpty() && !hook.signature.isNull() && !msg.signature().isEmpty()) evaluated: hook.signature.isEmpty() yes Evaluation Count:141 | yes Evaluation Count:36 |
evaluated: !hook.signature.isNull() yes Evaluation Count:12 | yes Evaluation Count:129 |
evaluated: !msg.signature().isEmpty() yes Evaluation Count:8 | yes Evaluation Count:4 |
| 4-141 |
1570 | continue; executed: continue; Execution Count:8 | 8 |
1571 | if (!hook.argumentMatch.isEmpty()) { evaluated: !hook.argumentMatch.isEmpty() yes Evaluation Count:37 | yes Evaluation Count:132 |
| 37-132 |
1572 | const QVariantList arguments = msg.arguments(); executed (the execution status of this line is deduced): const QVariantList arguments = msg.arguments(); | - |
1573 | if (hook.argumentMatch.size() > arguments.size()) partially evaluated: hook.argumentMatch.size() > arguments.size() no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
1574 | continue; never executed: continue; | 0 |
1575 | | - |
1576 | bool matched = true; executed (the execution status of this line is deduced): bool matched = true; | - |
1577 | for (int i = 0; i < hook.argumentMatch.size(); ++i) { evaluated: i < hook.argumentMatch.size() yes Evaluation Count:47 | yes Evaluation Count:17 |
| 17-47 |
1578 | const QString ¶m = hook.argumentMatch.at(i); executed (the execution status of this line is deduced): const QString ¶m = hook.argumentMatch.at(i); | - |
1579 | if (param.isNull()) evaluated: param.isNull() yes Evaluation Count:2 | yes Evaluation Count:45 |
| 2-45 |
1580 | continue; // don't try to match against this executed: continue; Execution Count:2 | 2 |
1581 | if (param == arguments.at(i).toString()) evaluated: param == arguments.at(i).toString() yes Evaluation Count:25 | yes Evaluation Count:20 |
| 20-25 |
1582 | continue; // matched executed: continue; Execution Count:25 | 25 |
1583 | matched = false; executed (the execution status of this line is deduced): matched = false; | - |
1584 | break; executed: break; Execution Count:20 | 20 |
1585 | } | - |
1586 | if (!matched) evaluated: !matched yes Evaluation Count:20 | yes Evaluation Count:17 |
| 17-20 |
1587 | continue; executed: continue; Execution Count:20 | 20 |
1588 | } executed: } Execution Count:17 | 17 |
1589 | | - |
1590 | activateSignal(hook, msg); executed (the execution status of this line is deduced): activateSignal(hook, msg); | - |
1591 | } executed: } Execution Count:149 | 149 |
1592 | } executed: } Execution Count:591 | 591 |
1593 | | - |
1594 | void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg) | - |
1595 | { | - |
1596 | // We call handlesignal(QString, QDBusMessage) three times: | - |
1597 | // one with member:interface | - |
1598 | // one with member: | - |
1599 | // one with :interface | - |
1600 | // This allows us to match signals with wildcards on member or interface | - |
1601 | // (but not both) | - |
1602 | | - |
1603 | QString key = msg.member(); executed (the execution status of this line is deduced): QString key = msg.member(); | - |
1604 | key.reserve(key.length() + 1 + msg.interface().length()); executed (the execution status of this line is deduced): key.reserve(key.length() + 1 + msg.interface().length()); | - |
1605 | key += QLatin1Char(':'); executed (the execution status of this line is deduced): key += QLatin1Char(':'); | - |
1606 | key += msg.interface(); executed (the execution status of this line is deduced): key += msg.interface(); | - |
1607 | | - |
1608 | QDBusReadLocker locker(HandleSignalAction, this); executed (the execution status of this line is deduced): QDBusReadLocker locker(HandleSignalAction, this); | - |
1609 | handleSignal(key, msg); // one try executed (the execution status of this line is deduced): handleSignal(key, msg); | - |
1610 | | - |
1611 | key.truncate(msg.member().length() + 1); // keep the ':' executed (the execution status of this line is deduced): key.truncate(msg.member().length() + 1); | - |
1612 | handleSignal(key, msg); // second try executed (the execution status of this line is deduced): handleSignal(key, msg); | - |
1613 | | - |
1614 | key = QLatin1Char(':'); executed (the execution status of this line is deduced): key = QLatin1Char(':'); | - |
1615 | key += msg.interface(); executed (the execution status of this line is deduced): key += msg.interface(); | - |
1616 | handleSignal(key, msg); // third try executed (the execution status of this line is deduced): handleSignal(key, msg); | - |
1617 | } executed: } Execution Count:197 | 197 |
1618 | | - |
1619 | static dbus_int32_t server_slot = -1; | - |
1620 | | - |
1621 | void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &error) | - |
1622 | { | - |
1623 | if (!s) { partially evaluated: !s no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1624 | handleError(error); never executed (the execution status of this line is deduced): handleError(error); | - |
1625 | return; | 0 |
1626 | } | - |
1627 | | - |
1628 | server = s; executed (the execution status of this line is deduced): server = s; | - |
1629 | mode = ServerMode; executed (the execution status of this line is deduced): mode = ServerMode; | - |
1630 | | - |
1631 | dbus_bool_t data_allocated = q_dbus_server_allocate_data_slot(&server_slot); executed (the execution status of this line is deduced): dbus_bool_t data_allocated = q_dbus_server_allocate_data_slot(&server_slot); | - |
1632 | if (data_allocated && server_slot < 0) partially evaluated: data_allocated yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: server_slot < 0 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1633 | return; | 0 |
1634 | | - |
1635 | dbus_bool_t watch_functions_set = q_dbus_server_set_watch_functions(server, executed (the execution status of this line is deduced): dbus_bool_t watch_functions_set = q_dbus_server_set_watch_functions(server, | - |
1636 | qDBusAddWatch, executed (the execution status of this line is deduced): qDBusAddWatch, | - |
1637 | qDBusRemoveWatch, executed (the execution status of this line is deduced): qDBusRemoveWatch, | - |
1638 | qDBusToggleWatch, executed (the execution status of this line is deduced): qDBusToggleWatch, | - |
1639 | this, 0); executed (the execution status of this line is deduced): this, 0); | - |
1640 | //qDebug() << "watch_functions_set" << watch_functions_set; | - |
1641 | Q_UNUSED(watch_functions_set); executed (the execution status of this line is deduced): (void)watch_functions_set;; | - |
1642 | | - |
1643 | dbus_bool_t time_functions_set = q_dbus_server_set_timeout_functions(server, executed (the execution status of this line is deduced): dbus_bool_t time_functions_set = q_dbus_server_set_timeout_functions(server, | - |
1644 | qDBusAddTimeout, executed (the execution status of this line is deduced): qDBusAddTimeout, | - |
1645 | qDBusRemoveTimeout, executed (the execution status of this line is deduced): qDBusRemoveTimeout, | - |
1646 | qDBusToggleTimeout, executed (the execution status of this line is deduced): qDBusToggleTimeout, | - |
1647 | this, 0); executed (the execution status of this line is deduced): this, 0); | - |
1648 | //qDebug() << "time_functions_set" << time_functions_set; | - |
1649 | Q_UNUSED(time_functions_set); executed (the execution status of this line is deduced): (void)time_functions_set;; | - |
1650 | | - |
1651 | q_dbus_server_set_new_connection_function(server, qDBusNewConnection, this, 0); executed (the execution status of this line is deduced): q_dbus_server_set_new_connection_function(server, qDBusNewConnection, this, 0); | - |
1652 | | - |
1653 | dbus_bool_t data_set = q_dbus_server_set_data(server, server_slot, this, 0); executed (the execution status of this line is deduced): dbus_bool_t data_set = q_dbus_server_set_data(server, server_slot, this, 0); | - |
1654 | //qDebug() << "data_set" << data_set; | - |
1655 | Q_UNUSED(data_set); executed (the execution status of this line is deduced): (void)data_set;; | - |
1656 | } executed: } Execution Count:8 | 8 |
1657 | | - |
1658 | void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal &error) | - |
1659 | { | - |
1660 | if (!c) { evaluated: !c yes Evaluation Count:3 | yes Evaluation Count:142 |
| 3-142 |
1661 | handleError(error); executed (the execution status of this line is deduced): handleError(error); | - |
1662 | return; executed: return; Execution Count:3 | 3 |
1663 | } | - |
1664 | | - |
1665 | connection = c; executed (the execution status of this line is deduced): connection = c; | - |
1666 | mode = PeerMode; executed (the execution status of this line is deduced): mode = PeerMode; | - |
1667 | | - |
1668 | q_dbus_connection_set_exit_on_disconnect(connection, false); executed (the execution status of this line is deduced): q_dbus_connection_set_exit_on_disconnect(connection, false); | - |
1669 | q_dbus_connection_set_watch_functions(connection, executed (the execution status of this line is deduced): q_dbus_connection_set_watch_functions(connection, | - |
1670 | qDBusAddWatch, executed (the execution status of this line is deduced): qDBusAddWatch, | - |
1671 | qDBusRemoveWatch, executed (the execution status of this line is deduced): qDBusRemoveWatch, | - |
1672 | qDBusToggleWatch, executed (the execution status of this line is deduced): qDBusToggleWatch, | - |
1673 | this, 0); executed (the execution status of this line is deduced): this, 0); | - |
1674 | q_dbus_connection_set_timeout_functions(connection, executed (the execution status of this line is deduced): q_dbus_connection_set_timeout_functions(connection, | - |
1675 | qDBusAddTimeout, executed (the execution status of this line is deduced): qDBusAddTimeout, | - |
1676 | qDBusRemoveTimeout, executed (the execution status of this line is deduced): qDBusRemoveTimeout, | - |
1677 | qDBusToggleTimeout, executed (the execution status of this line is deduced): qDBusToggleTimeout, | - |
1678 | this, 0); executed (the execution status of this line is deduced): this, 0); | - |
1679 | q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); executed (the execution status of this line is deduced): q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); | - |
1680 | q_dbus_connection_add_filter(connection, executed (the execution status of this line is deduced): q_dbus_connection_add_filter(connection, | - |
1681 | qDBusSignalFilter, executed (the execution status of this line is deduced): qDBusSignalFilter, | - |
1682 | this, 0); executed (the execution status of this line is deduced): this, 0); | - |
1683 | | - |
1684 | QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection); | - |
1685 | } executed: } Execution Count:142 | 142 |
1686 | | - |
1687 | static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnection *connection) | - |
1688 | { | - |
1689 | QDBusConnection::ConnectionCapabilities result = 0; executed (the execution status of this line is deduced): QDBusConnection::ConnectionCapabilities result = 0; | - |
1690 | typedef dbus_bool_t (*can_send_type_t)(DBusConnection *, int); executed (the execution status of this line is deduced): typedef dbus_bool_t (*can_send_type_t)(DBusConnection *, int); | - |
1691 | static can_send_type_t can_send_type = 0; | - |
1692 | | - |
1693 | #if defined(QT_LINKED_LIBDBUS) | - |
1694 | # if DBUS_VERSION-0 >= 0x010400 | - |
1695 | can_send_type = dbus_connection_can_send_type; | - |
1696 | # endif | - |
1697 | #else | - |
1698 | // run-time check if the next functions are available | - |
1699 | can_send_type = (can_send_type_t)qdbus_resolve_conditionally("dbus_connection_can_send_type"); executed (the execution status of this line is deduced): can_send_type = (can_send_type_t)qdbus_resolve_conditionally("dbus_connection_can_send_type"); | - |
1700 | #endif | - |
1701 | | - |
1702 | #ifndef DBUS_TYPE_UNIX_FD | - |
1703 | # define DBUS_TYPE_UNIX_FD int('h') | - |
1704 | #endif | - |
1705 | if (can_send_type && can_send_type(connection, DBUS_TYPE_UNIX_FD)) partially evaluated: can_send_type no Evaluation Count:0 | yes Evaluation Count:23 |
never evaluated: can_send_type(connection, int('h')) | 0-23 |
1706 | result |= QDBusConnection::UnixFileDescriptorPassing; never executed: result |= QDBusConnection::UnixFileDescriptorPassing; | 0 |
1707 | | - |
1708 | return result; executed: return result; Execution Count:23 | 23 |
1709 | } | - |
1710 | | - |
1711 | void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusErrorInternal &error) | - |
1712 | { | - |
1713 | if (!dbc) { evaluated: !dbc yes Evaluation Count:2 | yes Evaluation Count:23 |
| 2-23 |
1714 | handleError(error); executed (the execution status of this line is deduced): handleError(error); | - |
1715 | return; executed: return; Execution Count:2 | 2 |
1716 | } | - |
1717 | | - |
1718 | connection = dbc; executed (the execution status of this line is deduced): connection = dbc; | - |
1719 | mode = ClientMode; executed (the execution status of this line is deduced): mode = ClientMode; | - |
1720 | | - |
1721 | const char *service = q_dbus_bus_get_unique_name(connection); executed (the execution status of this line is deduced): const char *service = q_dbus_bus_get_unique_name(connection); | - |
1722 | Q_ASSERT(service); executed (the execution status of this line is deduced): qt_noop(); | - |
1723 | baseService = QString::fromUtf8(service); executed (the execution status of this line is deduced): baseService = QString::fromUtf8(service); | - |
1724 | capabilities = connectionCapabilies(connection); executed (the execution status of this line is deduced): capabilities = connectionCapabilies(connection); | - |
1725 | | - |
1726 | q_dbus_connection_set_exit_on_disconnect(connection, false); executed (the execution status of this line is deduced): q_dbus_connection_set_exit_on_disconnect(connection, false); | - |
1727 | q_dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch, executed (the execution status of this line is deduced): q_dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch, | - |
1728 | qDBusToggleWatch, this, 0); executed (the execution status of this line is deduced): qDBusToggleWatch, this, 0); | - |
1729 | q_dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout, executed (the execution status of this line is deduced): q_dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout, | - |
1730 | qDBusToggleTimeout, this, 0); executed (the execution status of this line is deduced): qDBusToggleTimeout, this, 0); | - |
1731 | q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); executed (the execution status of this line is deduced): q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); | - |
1732 | q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0); executed (the execution status of this line is deduced): q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0); | - |
1733 | | - |
1734 | // Initialize the hooks for the NameAcquired and NameLost signals | - |
1735 | // we don't use connectSignal here because we don't need the rules to be sent to the bus | - |
1736 | // the bus will always send us these two signals | - |
1737 | SignalHook hook; executed (the execution status of this line is deduced): SignalHook hook; | - |
1738 | hook.service = dbusServiceString(); executed (the execution status of this line is deduced): hook.service = dbusServiceString(); | - |
1739 | hook.path.clear(); // no matching executed (the execution status of this line is deduced): hook.path.clear(); | - |
1740 | hook.obj = this; executed (the execution status of this line is deduced): hook.obj = this; | - |
1741 | hook.params << QMetaType::Void << QVariant::String; // both functions take a QString as parameter and return void executed (the execution status of this line is deduced): hook.params << QMetaType::Void << QVariant::String; | - |
1742 | | - |
1743 | hook.midx = staticMetaObject.indexOfSlot("registerServiceNoLock(QString)"); executed (the execution status of this line is deduced): hook.midx = staticMetaObject.indexOfSlot("registerServiceNoLock(QString)"); | - |
1744 | Q_ASSERT(hook.midx != -1); executed (the execution status of this line is deduced): qt_noop(); | - |
1745 | signalHooks.insert(QLatin1String("NameAcquired:" DBUS_INTERFACE_DBUS), hook); executed (the execution status of this line is deduced): signalHooks.insert(QLatin1String("NameAcquired:" "org.freedesktop.DBus"), hook); | - |
1746 | | - |
1747 | hook.midx = staticMetaObject.indexOfSlot("unregisterServiceNoLock(QString)"); executed (the execution status of this line is deduced): hook.midx = staticMetaObject.indexOfSlot("unregisterServiceNoLock(QString)"); | - |
1748 | Q_ASSERT(hook.midx != -1); executed (the execution status of this line is deduced): qt_noop(); | - |
1749 | signalHooks.insert(QLatin1String("NameLost:" DBUS_INTERFACE_DBUS), hook); executed (the execution status of this line is deduced): signalHooks.insert(QLatin1String("NameLost:" "org.freedesktop.DBus"), hook); | - |
1750 | | - |
1751 | qDBusDebug() << this << ": connected successfully"; executed: ; Execution Count:23 never executed: QMessageLogger("qdbusintegrator.cpp", 1751, __PRETTY_FUNCTION__).debug() << this << ": connected successfully"; partially evaluated: !::isDebugging yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-23 |
1752 | | - |
1753 | // schedule a dispatch: | - |
1754 | QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection); | - |
1755 | } executed: } Execution Count:23 | 23 |
1756 | | - |
1757 | extern "C"{ | - |
1758 | static void qDBusResultReceived(DBusPendingCall *pending, void *user_data) | - |
1759 | { | - |
1760 | QDBusPendingCallPrivate *call = reinterpret_cast<QDBusPendingCallPrivate *>(user_data); executed (the execution status of this line is deduced): QDBusPendingCallPrivate *call = reinterpret_cast<QDBusPendingCallPrivate *>(user_data); | - |
1761 | Q_ASSERT(call->pending == pending); executed (the execution status of this line is deduced): qt_noop(); | - |
1762 | Q_UNUSED(pending); executed (the execution status of this line is deduced): (void)pending;; | - |
1763 | QDBusConnectionPrivate::processFinishedCall(call); executed (the execution status of this line is deduced): QDBusConnectionPrivate::processFinishedCall(call); | - |
1764 | } executed: } Execution Count:154 | 154 |
1765 | } | - |
1766 | | - |
1767 | void QDBusConnectionPrivate::waitForFinished(QDBusPendingCallPrivate *pcall) | - |
1768 | { | - |
1769 | Q_ASSERT(pcall->pending); executed (the execution status of this line is deduced): qt_noop(); | - |
1770 | Q_ASSERT(!pcall->autoDelete); executed (the execution status of this line is deduced): qt_noop(); | - |
1771 | //Q_ASSERT(pcall->mutex.isLocked()); // there's no such function | - |
1772 | | - |
1773 | if (pcall->waitingForFinished) { partially evaluated: pcall->waitingForFinished no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
1774 | // another thread is already waiting | - |
1775 | pcall->waitForFinishedCondition.wait(&pcall->mutex); never executed (the execution status of this line is deduced): pcall->waitForFinishedCondition.wait(&pcall->mutex); | - |
1776 | } else { | 0 |
1777 | pcall->waitingForFinished = true; executed (the execution status of this line is deduced): pcall->waitingForFinished = true; | - |
1778 | pcall->mutex.unlock(); executed (the execution status of this line is deduced): pcall->mutex.unlock(); | - |
1779 | | - |
1780 | { | - |
1781 | QDBusDispatchLocker locker(PendingCallBlockAction, this); executed (the execution status of this line is deduced): QDBusDispatchLocker locker(PendingCallBlockAction, this); | - |
1782 | q_dbus_pending_call_block(pcall->pending); executed (the execution status of this line is deduced): q_dbus_pending_call_block(pcall->pending); | - |
1783 | // QDBusConnectionPrivate::processFinishedCall() is called automatically | - |
1784 | } | - |
1785 | pcall->mutex.lock(); executed (the execution status of this line is deduced): pcall->mutex.lock(); | - |
1786 | pcall->waitForFinishedCondition.wakeAll(); executed (the execution status of this line is deduced): pcall->waitForFinishedCondition.wakeAll(); | - |
1787 | } executed: } Execution Count:19 | 19 |
1788 | } | - |
1789 | | - |
1790 | static inline bool waitingForFinishedIsSet(QDBusPendingCallPrivate *call) | - |
1791 | { | - |
1792 | const QMutexLocker locker(&call->mutex); never executed (the execution status of this line is deduced): const QMutexLocker locker(&call->mutex); | - |
1793 | return call->waitingForFinished; never executed: return call->waitingForFinished; | 0 |
1794 | } | - |
1795 | | - |
1796 | void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call) | - |
1797 | { | - |
1798 | QDBusConnectionPrivate *connection = const_cast<QDBusConnectionPrivate *>(call->connection); executed (the execution status of this line is deduced): QDBusConnectionPrivate *connection = const_cast<QDBusConnectionPrivate *>(call->connection); | - |
1799 | | - |
1800 | QMutexLocker locker(&call->mutex); executed (the execution status of this line is deduced): QMutexLocker locker(&call->mutex); | - |
1801 | | - |
1802 | QDBusMessage &msg = call->replyMessage; executed (the execution status of this line is deduced): QDBusMessage &msg = call->replyMessage; | - |
1803 | if (call->pending) { evaluated: call->pending yes Evaluation Count:154 | yes Evaluation Count:4 |
| 4-154 |
1804 | // decode the message | - |
1805 | DBusMessage *reply = q_dbus_pending_call_steal_reply(call->pending); executed (the execution status of this line is deduced): DBusMessage *reply = q_dbus_pending_call_steal_reply(call->pending); | - |
1806 | msg = QDBusMessagePrivate::fromDBusMessage(reply, connection->capabilities); executed (the execution status of this line is deduced): msg = QDBusMessagePrivate::fromDBusMessage(reply, connection->capabilities); | - |
1807 | q_dbus_message_unref(reply); executed (the execution status of this line is deduced): q_dbus_message_unref(reply); | - |
1808 | } executed: } Execution Count:154 | 154 |
1809 | qDBusDebug() << connection << "got message reply (async):" << msg; executed: ; Execution Count:158 never executed: QMessageLogger("qdbusintegrator.cpp", 1809, __PRETTY_FUNCTION__).debug() << connection << "got message reply (async):" << msg; partially evaluated: !::isDebugging yes Evaluation Count:158 | no Evaluation Count:0 |
| 0-158 |
1810 | | - |
1811 | // Check if the reply has the expected signature | - |
1812 | call->checkReceivedSignature(); executed (the execution status of this line is deduced): call->checkReceivedSignature(); | - |
1813 | | - |
1814 | if (!call->receiver.isNull() && call->methodIdx != -1 && msg.type() == QDBusMessage::ReplyMessage) { evaluated: !call->receiver.isNull() yes Evaluation Count:7 | yes Evaluation Count:151 |
partially evaluated: call->methodIdx != -1 yes Evaluation Count:7 | no Evaluation Count:0 |
partially evaluated: msg.type() == QDBusMessage::ReplyMessage yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-151 |
1815 | // Deliver the return values of a remote function call. | - |
1816 | // | - |
1817 | // There is only one connection and it is specified by idx | - |
1818 | // The slot must have the same parameter types that the message does | - |
1819 | // The slot may have less parameters than the message | - |
1820 | // The slot may optionally have one final parameter that is QDBusMessage | - |
1821 | // The slot receives read-only copies of the message (i.e., pass by value or by const-ref) | - |
1822 | | - |
1823 | QDBusCallDeliveryEvent *e = prepareReply(connection, call->receiver, call->methodIdx, never executed (the execution status of this line is deduced): QDBusCallDeliveryEvent *e = prepareReply(connection, call->receiver, call->methodIdx, | - |
1824 | call->metaTypes, msg); never executed (the execution status of this line is deduced): call->metaTypes, msg); | - |
1825 | if (e) partially evaluated: e yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
1826 | connection->postEventToThread(MessageResultReceivedAction, call->receiver, e); executed: connection->postEventToThread(MessageResultReceivedAction, call->receiver, e); Execution Count:7 | 7 |
1827 | else | - |
1828 | qDBusDebug() << "Deliver failed!"; never executed: ; never executed: QMessageLogger("qdbusintegrator.cpp", 1828, __PRETTY_FUNCTION__).debug() << "Deliver failed!"; never evaluated: !::isDebugging | 0 |
1829 | } | - |
1830 | | - |
1831 | if (call->pending) evaluated: call->pending yes Evaluation Count:154 | yes Evaluation Count:4 |
| 4-154 |
1832 | q_dbus_pending_call_unref(call->pending); executed: q_dbus_pending_call_unref(call->pending); Execution Count:154 | 154 |
1833 | call->pending = 0; executed (the execution status of this line is deduced): call->pending = 0; | - |
1834 | | - |
1835 | locker.unlock(); executed (the execution status of this line is deduced): locker.unlock(); | - |
1836 | | - |
1837 | // Are there any watchers? | - |
1838 | if (call->watcherHelper) evaluated: call->watcherHelper yes Evaluation Count:134 | yes Evaluation Count:24 |
| 24-134 |
1839 | call->watcherHelper->emitSignals(msg, call->sentMessage); executed: call->watcherHelper->emitSignals(msg, call->sentMessage); Execution Count:134 | 134 |
1840 | | - |
1841 | if (msg.type() == QDBusMessage::ErrorMessage) evaluated: msg.type() == QDBusMessage::ErrorMessage yes Evaluation Count:67 | yes Evaluation Count:91 |
| 67-91 |
1842 | emit connection->callWithCallbackFailed(QDBusError(msg), call->sentMessage); executed: connection->callWithCallbackFailed(QDBusError(msg), call->sentMessage); Execution Count:67 | 67 |
1843 | | - |
1844 | if (call->autoDelete) { evaluated: call->autoDelete yes Evaluation Count:5 | yes Evaluation Count:153 |
| 5-153 |
1845 | Q_ASSERT(!waitingForFinishedIsSet(call)); // can't wait on a call with autoDelete! executed (the execution status of this line is deduced): qt_noop(); | - |
1846 | delete call; executed (the execution status of this line is deduced): delete call; | - |
1847 | } executed: } Execution Count:5 | 5 |
1848 | } executed: } Execution Count:158 | 158 |
1849 | | - |
1850 | int QDBusConnectionPrivate::send(const QDBusMessage& message) | - |
1851 | { | - |
1852 | if (QDBusMessagePrivate::isLocal(message)) evaluated: QDBusMessagePrivate::isLocal(message) yes Evaluation Count:364 | yes Evaluation Count:177 |
| 177-364 |
1853 | return -1; // don't send; the reply will be retrieved by the caller executed: return -1; Execution Count:364 | 364 |
1854 | // through the d_ptr->localReply link | - |
1855 | | - |
1856 | QDBusError error; executed (the execution status of this line is deduced): QDBusError error; | - |
1857 | DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error); executed (the execution status of this line is deduced): DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error); | - |
1858 | if (!msg) { partially evaluated: !msg no Evaluation Count:0 | yes Evaluation Count:177 |
| 0-177 |
1859 | if (message.type() == QDBusMessage::MethodCallMessage) never evaluated: message.type() == QDBusMessage::MethodCallMessage | 0 |
1860 | qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", never executed: QMessageLogger("qdbusintegrator.cpp", 1860, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", QString(message.service()).toLocal8Bit().constData(), QString(message.path()).toLocal8Bit().constData(), QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1861 | qPrintable(message.service()), qPrintable(message.path()), never executed: QMessageLogger("qdbusintegrator.cpp", 1860, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", QString(message.service()).toLocal8Bit().constData(), QString(message.path()).toLocal8Bit().constData(), QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1862 | qPrintable(message.interface()), qPrintable(message.member()), never executed: QMessageLogger("qdbusintegrator.cpp", 1860, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", QString(message.service()).toLocal8Bit().constData(), QString(message.path()).toLocal8Bit().constData(), QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1863 | qPrintable(error.message())); never executed: QMessageLogger("qdbusintegrator.cpp", 1860, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", QString(message.service()).toLocal8Bit().constData(), QString(message.path()).toLocal8Bit().constData(), QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1864 | else if (message.type() == QDBusMessage::SignalMessage) never evaluated: message.type() == QDBusMessage::SignalMessage | 0 |
1865 | qWarning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\": %s", never executed: QMessageLogger("qdbusintegrator.cpp", 1865, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\": %s", QString(message.path()).toLocal8Bit().constData(), QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1866 | qPrintable(message.path()), qPrintable(message.interface()), never executed: QMessageLogger("qdbusintegrator.cpp", 1865, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\": %s", QString(message.path()).toLocal8Bit().constData(), QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1867 | qPrintable(message.member()), never executed: QMessageLogger("qdbusintegrator.cpp", 1865, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\": %s", QString(message.path()).toLocal8Bit().constData(), QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1868 | qPrintable(error.message())); never executed: QMessageLogger("qdbusintegrator.cpp", 1865, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\": %s", QString(message.path()).toLocal8Bit().constData(), QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1869 | else | - |
1870 | qWarning("QDBusConnection: error: could not send %s message to service \"%s\": %s", never executed: QMessageLogger("qdbusintegrator.cpp", 1870, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send %s message to service \"%s\": %s", message.type() == QDBusMessage::ReplyMessage ? "reply" : message.type() == QDBusMessage::ErrorMessage ? "error" : "invalid", QString(message.service()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1871 | message.type() == QDBusMessage::ReplyMessage ? "reply" : never executed: QMessageLogger("qdbusintegrator.cpp", 1870, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send %s message to service \"%s\": %s", message.type() == QDBusMessage::ReplyMessage ? "reply" : message.type() == QDBusMessage::ErrorMessage ? "error" : "invalid", QString(message.service()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1872 | message.type() == QDBusMessage::ErrorMessage ? "error" : never executed: QMessageLogger("qdbusintegrator.cpp", 1870, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send %s message to service \"%s\": %s", message.type() == QDBusMessage::ReplyMessage ? "reply" : message.type() == QDBusMessage::ErrorMessage ? "error" : "invalid", QString(message.service()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1873 | "invalid", qPrintable(message.service()), never executed: QMessageLogger("qdbusintegrator.cpp", 1870, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send %s message to service \"%s\": %s", message.type() == QDBusMessage::ReplyMessage ? "reply" : message.type() == QDBusMessage::ErrorMessage ? "error" : "invalid", QString(message.service()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1874 | qPrintable(error.message())); never executed: QMessageLogger("qdbusintegrator.cpp", 1870, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send %s message to service \"%s\": %s", message.type() == QDBusMessage::ReplyMessage ? "reply" : message.type() == QDBusMessage::ErrorMessage ? "error" : "invalid", QString(message.service()).toLocal8Bit().constData(), QString(error.message()).toLocal8Bit().constData()); | 0 |
1875 | lastError = error; never executed (the execution status of this line is deduced): lastError = error; | - |
1876 | return 0; never executed: return 0; | 0 |
1877 | } | - |
1878 | | - |
1879 | q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything executed (the execution status of this line is deduced): q_dbus_message_set_no_reply(msg, true); | - |
1880 | | - |
1881 | qDBusDebug() << this << "sending message (no reply):" << message; executed: ; Execution Count:177 never executed: QMessageLogger("qdbusintegrator.cpp", 1881, __PRETTY_FUNCTION__).debug() << this << "sending message (no reply):" << message; partially evaluated: !::isDebugging yes Evaluation Count:177 | no Evaluation Count:0 |
| 0-177 |
1882 | checkThread(); executed (the execution status of this line is deduced): checkThread(); | - |
1883 | bool isOk = q_dbus_connection_send(connection, msg, 0); executed (the execution status of this line is deduced): bool isOk = q_dbus_connection_send(connection, msg, 0); | - |
1884 | int serial = 0; executed (the execution status of this line is deduced): int serial = 0; | - |
1885 | if (isOk) partially evaluated: isOk yes Evaluation Count:177 | no Evaluation Count:0 |
| 0-177 |
1886 | serial = q_dbus_message_get_serial(msg); executed: serial = q_dbus_message_get_serial(msg); Execution Count:177 | 177 |
1887 | | - |
1888 | q_dbus_message_unref(msg); executed (the execution status of this line is deduced): q_dbus_message_unref(msg); | - |
1889 | return serial; executed: return serial; Execution Count:177 | 177 |
1890 | } | - |
1891 | | - |
1892 | QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message, | - |
1893 | int sendMode, int timeout) | - |
1894 | { | - |
1895 | checkThread(); executed (the execution status of this line is deduced): checkThread(); | - |
1896 | if ((sendMode == QDBus::BlockWithGui || sendMode == QDBus::Block) evaluated: sendMode == QDBus::BlockWithGui yes Evaluation Count:253 | yes Evaluation Count:1377 |
partially evaluated: sendMode == QDBus::Block yes Evaluation Count:1377 | no Evaluation Count:0 |
| 0-1377 |
1897 | && isServiceRegisteredByThread(message.service())) evaluated: isServiceRegisteredByThread(message.service()) yes Evaluation Count:308 | yes Evaluation Count:1322 |
| 308-1322 |
1898 | // special case for synchronous local calls | - |
1899 | return sendWithReplyLocal(message); executed: return sendWithReplyLocal(message); Execution Count:308 | 308 |
1900 | | - |
1901 | if (!QCoreApplication::instance() || sendMode == QDBus::Block) { partially evaluated: !QCoreApplication::instance() no Evaluation Count:0 | yes Evaluation Count:1322 |
evaluated: sendMode == QDBus::Block yes Evaluation Count:1196 | yes Evaluation Count:126 |
| 0-1322 |
1902 | QDBusError err; executed (the execution status of this line is deduced): QDBusError err; | - |
1903 | DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &err); executed (the execution status of this line is deduced): DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &err); | - |
1904 | if (!msg) { partially evaluated: !msg no Evaluation Count:0 | yes Evaluation Count:1196 |
| 0-1196 |
1905 | qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", never executed (the execution status of this line is deduced): QMessageLogger("qdbusintegrator.cpp", 1905, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", | - |
1906 | qPrintable(message.service()), qPrintable(message.path()), never executed (the execution status of this line is deduced): QString(message.service()).toLocal8Bit().constData(), QString(message.path()).toLocal8Bit().constData(), | - |
1907 | qPrintable(message.interface()), qPrintable(message.member()), never executed (the execution status of this line is deduced): QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), | - |
1908 | qPrintable(err.message())); never executed (the execution status of this line is deduced): QString(err.message()).toLocal8Bit().constData()); | - |
1909 | lastError = err; never executed (the execution status of this line is deduced): lastError = err; | - |
1910 | return QDBusMessage::createError(err); never executed: return QDBusMessage::createError(err); | 0 |
1911 | } | - |
1912 | | - |
1913 | qDBusDebug() << this << "sending message (blocking):" << message; executed: ; Execution Count:1196 never executed: QMessageLogger("qdbusintegrator.cpp", 1913, __PRETTY_FUNCTION__).debug() << this << "sending message (blocking):" << message; partially evaluated: !::isDebugging yes Evaluation Count:1196 | no Evaluation Count:0 |
| 0-1196 |
1914 | QDBusErrorInternal error; executed (the execution status of this line is deduced): QDBusErrorInternal error; | - |
1915 | DBusMessage *reply = q_dbus_connection_send_with_reply_and_block(connection, msg, timeout, error); executed (the execution status of this line is deduced): DBusMessage *reply = q_dbus_connection_send_with_reply_and_block(connection, msg, timeout, error); | - |
1916 | | - |
1917 | q_dbus_message_unref(msg); executed (the execution status of this line is deduced): q_dbus_message_unref(msg); | - |
1918 | | - |
1919 | if (!!error) { evaluated: !!error yes Evaluation Count:12 | yes Evaluation Count:1184 |
| 12-1184 |
1920 | lastError = err = error; executed (the execution status of this line is deduced): lastError = err = error; | - |
1921 | return QDBusMessage::createError(err); executed: return QDBusMessage::createError(err); Execution Count:12 | 12 |
1922 | } | - |
1923 | | - |
1924 | QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(reply, capabilities); executed (the execution status of this line is deduced): QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(reply, capabilities); | - |
1925 | q_dbus_message_unref(reply); executed (the execution status of this line is deduced): q_dbus_message_unref(reply); | - |
1926 | qDBusDebug() << this << "got message reply (blocking):" << amsg; executed: ; Execution Count:1184 never executed: QMessageLogger("qdbusintegrator.cpp", 1926, __PRETTY_FUNCTION__).debug() << this << "got message reply (blocking):" << amsg; partially evaluated: !::isDebugging yes Evaluation Count:1184 | no Evaluation Count:0 |
| 0-1184 |
1927 | | - |
1928 | return amsg; executed: return amsg; Execution Count:1184 | 1184 |
1929 | } else { // use the event loop | - |
1930 | QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); executed (the execution status of this line is deduced): QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); | - |
1931 | Q_ASSERT(pcall); executed (the execution status of this line is deduced): qt_noop(); | - |
1932 | | - |
1933 | if (pcall->replyMessage.type() == QDBusMessage::InvalidMessage) { partially evaluated: pcall->replyMessage.type() == QDBusMessage::InvalidMessage yes Evaluation Count:126 | no Evaluation Count:0 |
| 0-126 |
1934 | pcall->watcherHelper = new QDBusPendingCallWatcherHelper; executed (the execution status of this line is deduced): pcall->watcherHelper = new QDBusPendingCallWatcherHelper; | - |
1935 | QEventLoop loop; executed (the execution status of this line is deduced): QEventLoop loop; | - |
1936 | loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit())); executed (the execution status of this line is deduced): loop.connect(pcall->watcherHelper, "2""reply(QDBusMessage)", "1""quit()"); | - |
1937 | loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit())); executed (the execution status of this line is deduced): loop.connect(pcall->watcherHelper, "2""error(QDBusError,QDBusMessage)", "1""quit()"); | - |
1938 | | - |
1939 | // enter the event loop and wait for a reply | - |
1940 | loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents); executed (the execution status of this line is deduced): loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents); | - |
1941 | } executed: } Execution Count:126 | 126 |
1942 | | - |
1943 | QDBusMessage reply = pcall->replyMessage; executed (the execution status of this line is deduced): QDBusMessage reply = pcall->replyMessage; | - |
1944 | lastError = QDBusError(reply); // set or clear error executed (the execution status of this line is deduced): lastError = QDBusError(reply); | - |
1945 | | - |
1946 | delete pcall; executed (the execution status of this line is deduced): delete pcall; | - |
1947 | return reply; executed: return reply; Execution Count:126 | 126 |
1948 | } | - |
1949 | } | - |
1950 | | - |
1951 | QDBusMessage QDBusConnectionPrivate::sendWithReplyLocal(const QDBusMessage &message) | - |
1952 | { | - |
1953 | qDBusDebug() << this << "sending message via local-loop:" << message; executed: ; Execution Count:364 never executed: QMessageLogger("qdbusintegrator.cpp", 1953, __PRETTY_FUNCTION__).debug() << this << "sending message via local-loop:" << message; partially evaluated: !::isDebugging yes Evaluation Count:364 | no Evaluation Count:0 |
| 0-364 |
1954 | | - |
1955 | QDBusMessage localCallMsg = QDBusMessagePrivate::makeLocal(*this, message); executed (the execution status of this line is deduced): QDBusMessage localCallMsg = QDBusMessagePrivate::makeLocal(*this, message); | - |
1956 | bool handled = handleMessage(localCallMsg); executed (the execution status of this line is deduced): bool handled = handleMessage(localCallMsg); | - |
1957 | | - |
1958 | if (!handled) { partially evaluated: !handled no Evaluation Count:0 | yes Evaluation Count:364 |
| 0-364 |
1959 | QString interface = message.interface(); never executed (the execution status of this line is deduced): QString interface = message.interface(); | - |
1960 | if (interface.isEmpty()) never evaluated: interface.isEmpty() | 0 |
1961 | interface = QLatin1String("<no-interface>"); never executed: interface = QLatin1String("<no-interface>"); | 0 |
1962 | return QDBusMessage::createError(QDBusError::InternalError, never executed: return QDBusMessage::createError(QDBusError::InternalError, QString::fromLatin1("Internal error trying to call %1.%2 at %3 (signature '%4'") .arg(interface, message.member(), message.path(), message.signature())); | 0 |
1963 | QString::fromLatin1("Internal error trying to call %1.%2 at %3 (signature '%4'") never executed: return QDBusMessage::createError(QDBusError::InternalError, QString::fromLatin1("Internal error trying to call %1.%2 at %3 (signature '%4'") .arg(interface, message.member(), message.path(), message.signature())); | 0 |
1964 | .arg(interface, message.member(), never executed: return QDBusMessage::createError(QDBusError::InternalError, QString::fromLatin1("Internal error trying to call %1.%2 at %3 (signature '%4'") .arg(interface, message.member(), message.path(), message.signature())); | 0 |
1965 | message.path(), message.signature())); never executed: return QDBusMessage::createError(QDBusError::InternalError, QString::fromLatin1("Internal error trying to call %1.%2 at %3 (signature '%4'") .arg(interface, message.member(), message.path(), message.signature())); | 0 |
1966 | } | - |
1967 | | - |
1968 | // if the message was handled, there might be a reply | - |
1969 | QDBusMessage localReplyMsg = QDBusMessagePrivate::makeLocalReply(*this, localCallMsg); executed (the execution status of this line is deduced): QDBusMessage localReplyMsg = QDBusMessagePrivate::makeLocalReply(*this, localCallMsg); | - |
1970 | if (localReplyMsg.type() == QDBusMessage::InvalidMessage) { evaluated: localReplyMsg.type() == QDBusMessage::InvalidMessage yes Evaluation Count:2 | yes Evaluation Count:362 |
| 2-362 |
1971 | qWarning("QDBusConnection: cannot call local method '%s' at object %s (with signature '%s') " executed (the execution status of this line is deduced): QMessageLogger("qdbusintegrator.cpp", 1971, __PRETTY_FUNCTION__).warning("QDBusConnection: cannot call local method '%s' at object %s (with signature '%s') " | - |
1972 | "on blocking mode", qPrintable(message.member()), qPrintable(message.path()), executed (the execution status of this line is deduced): "on blocking mode", QString(message.member()).toLocal8Bit().constData(), QString(message.path()).toLocal8Bit().constData(), | - |
1973 | qPrintable(message.signature())); executed (the execution status of this line is deduced): QString(message.signature()).toLocal8Bit().constData()); | - |
1974 | return QDBusMessage::createError( executed: return QDBusMessage::createError( QDBusError(QDBusError::InternalError, QLatin1String("local-loop message cannot have delayed replies"))); Execution Count:2 | 2 |
1975 | QDBusError(QDBusError::InternalError, executed: return QDBusMessage::createError( QDBusError(QDBusError::InternalError, QLatin1String("local-loop message cannot have delayed replies"))); Execution Count:2 | 2 |
1976 | QLatin1String("local-loop message cannot have delayed replies"))); executed: return QDBusMessage::createError( QDBusError(QDBusError::InternalError, QLatin1String("local-loop message cannot have delayed replies"))); Execution Count:2 | 2 |
1977 | } | - |
1978 | | - |
1979 | // there is a reply | - |
1980 | qDBusDebug() << this << "got message via local-loop:" << localReplyMsg; executed: ; Execution Count:362 never executed: QMessageLogger("qdbusintegrator.cpp", 1980, __PRETTY_FUNCTION__).debug() << this << "got message via local-loop:" << localReplyMsg; partially evaluated: !::isDebugging yes Evaluation Count:362 | no Evaluation Count:0 |
| 0-362 |
1981 | return localReplyMsg; executed: return localReplyMsg; Execution Count:362 | 362 |
1982 | } | - |
1983 | | - |
1984 | QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, | - |
1985 | int timeout) | - |
1986 | { | - |
1987 | if (isServiceRegisteredByThread(message.service())) { evaluated: isServiceRegisteredByThread(message.service()) yes Evaluation Count:56 | yes Evaluation Count:154 |
| 56-154 |
1988 | // special case for local calls | - |
1989 | QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this); executed (the execution status of this line is deduced): QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this); | - |
1990 | pcall->replyMessage = sendWithReplyLocal(message); executed (the execution status of this line is deduced): pcall->replyMessage = sendWithReplyLocal(message); | - |
1991 | | - |
1992 | return pcall; executed: return pcall; Execution Count:56 | 56 |
1993 | } | - |
1994 | | - |
1995 | checkThread(); executed (the execution status of this line is deduced): checkThread(); | - |
1996 | QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this); executed (the execution status of this line is deduced): QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this); | - |
1997 | pcall->ref.store(0); executed (the execution status of this line is deduced): pcall->ref.store(0); | - |
1998 | | - |
1999 | QDBusError error; executed (the execution status of this line is deduced): QDBusError error; | - |
2000 | DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error); executed (the execution status of this line is deduced): DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error); | - |
2001 | if (!msg) { partially evaluated: !msg no Evaluation Count:0 | yes Evaluation Count:154 |
| 0-154 |
2002 | qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", never executed (the execution status of this line is deduced): QMessageLogger("qdbusintegrator.cpp", 2002, __PRETTY_FUNCTION__).warning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", | - |
2003 | qPrintable(message.service()), qPrintable(message.path()), never executed (the execution status of this line is deduced): QString(message.service()).toLocal8Bit().constData(), QString(message.path()).toLocal8Bit().constData(), | - |
2004 | qPrintable(message.interface()), qPrintable(message.member()), never executed (the execution status of this line is deduced): QString(message.interface()).toLocal8Bit().constData(), QString(message.member()).toLocal8Bit().constData(), | - |
2005 | qPrintable(error.message())); never executed (the execution status of this line is deduced): QString(error.message()).toLocal8Bit().constData()); | - |
2006 | pcall->replyMessage = QDBusMessage::createError(error); never executed (the execution status of this line is deduced): pcall->replyMessage = QDBusMessage::createError(error); | - |
2007 | lastError = error; never executed (the execution status of this line is deduced): lastError = error; | - |
2008 | return pcall; never executed: return pcall; | 0 |
2009 | } | - |
2010 | | - |
2011 | qDBusDebug() << this << "sending message (async):" << message; executed: ; Execution Count:154 never executed: QMessageLogger("qdbusintegrator.cpp", 2011, __PRETTY_FUNCTION__).debug() << this << "sending message (async):" << message; partially evaluated: !::isDebugging yes Evaluation Count:154 | no Evaluation Count:0 |
| 0-154 |
2012 | DBusPendingCall *pending = 0; executed (the execution status of this line is deduced): DBusPendingCall *pending = 0; | - |
2013 | | - |
2014 | QDBusDispatchLocker locker(SendWithReplyAsyncAction, this); executed (the execution status of this line is deduced): QDBusDispatchLocker locker(SendWithReplyAsyncAction, this); | - |
2015 | if (q_dbus_connection_send_with_reply(connection, msg, &pending, timeout)) { partially evaluated: q_dbus_connection_send_with_reply(connection, msg, &pending, timeout) yes Evaluation Count:154 | no Evaluation Count:0 |
| 0-154 |
2016 | if (pending) { partially evaluated: pending yes Evaluation Count:154 | no Evaluation Count:0 |
| 0-154 |
2017 | q_dbus_message_unref(msg); executed (the execution status of this line is deduced): q_dbus_message_unref(msg); | - |
2018 | | - |
2019 | pcall->pending = pending; executed (the execution status of this line is deduced): pcall->pending = pending; | - |
2020 | q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, 0); executed (the execution status of this line is deduced): q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, 0); | - |
2021 | | - |
2022 | return pcall; executed: return pcall; Execution Count:154 | 154 |
2023 | } else { | - |
2024 | // we're probably disconnected at this point | - |
2025 | lastError = error = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server")); never executed (the execution status of this line is deduced): lastError = error = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server")); | - |
2026 | } | 0 |
2027 | } else { | - |
2028 | lastError = error = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory")); never executed (the execution status of this line is deduced): lastError = error = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory")); | - |
2029 | } | 0 |
2030 | | - |
2031 | q_dbus_message_unref(msg); never executed (the execution status of this line is deduced): q_dbus_message_unref(msg); | - |
2032 | pcall->replyMessage = QDBusMessage::createError(error); never executed (the execution status of this line is deduced): pcall->replyMessage = QDBusMessage::createError(error); | - |
2033 | return pcall; never executed: return pcall; | 0 |
2034 | } | - |
2035 | | - |
2036 | int QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, | - |
2037 | const char *returnMethod, const char *errorMethod, | - |
2038 | int timeout) | - |
2039 | { | - |
2040 | QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); executed (the execution status of this line is deduced): QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); | - |
2041 | Q_ASSERT(pcall); executed (the execution status of this line is deduced): qt_noop(); | - |
2042 | | - |
2043 | // has it already finished with success (dispatched locally)? | - |
2044 | if (pcall->replyMessage.type() == QDBusMessage::ReplyMessage) { evaluated: pcall->replyMessage.type() == QDBusMessage::ReplyMessage yes Evaluation Count:2 | yes Evaluation Count:7 |
| 2-7 |
2045 | pcall->setReplyCallback(receiver, returnMethod); executed (the execution status of this line is deduced): pcall->setReplyCallback(receiver, returnMethod); | - |
2046 | processFinishedCall(pcall); executed (the execution status of this line is deduced): processFinishedCall(pcall); | - |
2047 | delete pcall; executed (the execution status of this line is deduced): delete pcall; | - |
2048 | return 1; executed: return 1; Execution Count:2 | 2 |
2049 | } | - |
2050 | | - |
2051 | // either it hasn't finished or it has finished with error | - |
2052 | if (errorMethod) { evaluated: errorMethod yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
2053 | pcall->watcherHelper = new QDBusPendingCallWatcherHelper; executed (the execution status of this line is deduced): pcall->watcherHelper = new QDBusPendingCallWatcherHelper; | - |
2054 | connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod, executed (the execution status of this line is deduced): connect(pcall->watcherHelper, "2""error(QDBusError,QDBusMessage)", receiver, errorMethod, | - |
2055 | Qt::QueuedConnection); executed (the execution status of this line is deduced): Qt::QueuedConnection); | - |
2056 | pcall->watcherHelper->moveToThread(thread()); executed (the execution status of this line is deduced): pcall->watcherHelper->moveToThread(thread()); | - |
2057 | } executed: } Execution Count:2 | 2 |
2058 | | - |
2059 | // has it already finished and is an error reply message? | - |
2060 | if (pcall->replyMessage.type() == QDBusMessage::ErrorMessage) { evaluated: pcall->replyMessage.type() == QDBusMessage::ErrorMessage yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
2061 | processFinishedCall(pcall); executed (the execution status of this line is deduced): processFinishedCall(pcall); | - |
2062 | delete pcall; executed (the execution status of this line is deduced): delete pcall; | - |
2063 | return 1; executed: return 1; Execution Count:2 | 2 |
2064 | } | - |
2065 | | - |
2066 | pcall->autoDelete = true; executed (the execution status of this line is deduced): pcall->autoDelete = true; | - |
2067 | pcall->ref.ref(); executed (the execution status of this line is deduced): pcall->ref.ref(); | - |
2068 | pcall->setReplyCallback(receiver, returnMethod); executed (the execution status of this line is deduced): pcall->setReplyCallback(receiver, returnMethod); | - |
2069 | | - |
2070 | return 1; executed: return 1; Execution Count:5 | 5 |
2071 | } | - |
2072 | | - |
2073 | bool QDBusConnectionPrivate::connectSignal(const QString &service, | - |
2074 | const QString &path, const QString &interface, const QString &name, | - |
2075 | const QStringList &argumentMatch, const QString &signature, | - |
2076 | QObject *receiver, const char *slot) | - |
2077 | { | - |
2078 | // check the slot | - |
2079 | QDBusConnectionPrivate::SignalHook hook; executed (the execution status of this line is deduced): QDBusConnectionPrivate::SignalHook hook; | - |
2080 | QString key; executed (the execution status of this line is deduced): QString key; | - |
2081 | QString name2 = name; executed (the execution status of this line is deduced): QString name2 = name; | - |
2082 | if (name2.isNull()) partially evaluated: name2.isNull() no Evaluation Count:0 | yes Evaluation Count:205 |
| 0-205 |
2083 | name2.detach(); never executed: name2.detach(); | 0 |
2084 | | - |
2085 | hook.signature = signature; executed (the execution status of this line is deduced): hook.signature = signature; | - |
2086 | if (!prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false)) partially evaluated: !prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false) no Evaluation Count:0 | yes Evaluation Count:205 |
| 0-205 |
2087 | return false; // don't connect never executed: return false; | 0 |
2088 | | - |
2089 | // avoid duplicating: | - |
2090 | QDBusConnectionPrivate::SignalHookHash::ConstIterator it = signalHooks.constFind(key); executed (the execution status of this line is deduced): QDBusConnectionPrivate::SignalHookHash::ConstIterator it = signalHooks.constFind(key); | - |
2091 | QDBusConnectionPrivate::SignalHookHash::ConstIterator end = signalHooks.constEnd(); executed (the execution status of this line is deduced): QDBusConnectionPrivate::SignalHookHash::ConstIterator end = signalHooks.constEnd(); | - |
2092 | for ( ; it != end && it.key() == key; ++it) { evaluated: it != end yes Evaluation Count:76 | yes Evaluation Count:180 |
evaluated: it.key() == key yes Evaluation Count:51 | yes Evaluation Count:25 |
| 25-180 |
2093 | const QDBusConnectionPrivate::SignalHook &entry = it.value(); executed (the execution status of this line is deduced): const QDBusConnectionPrivate::SignalHook &entry = it.value(); | - |
2094 | if (entry.service == hook.service && evaluated: entry.service == hook.service yes Evaluation Count:50 | yes Evaluation Count:1 |
| 1-50 |
2095 | entry.path == hook.path && evaluated: entry.path == hook.path yes Evaluation Count:35 | yes Evaluation Count:15 |
| 15-35 |
2096 | entry.signature == hook.signature && evaluated: entry.signature == hook.signature yes Evaluation Count:17 | yes Evaluation Count:18 |
| 17-18 |
2097 | entry.obj == hook.obj && partially evaluated: entry.obj == hook.obj no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
2098 | entry.midx == hook.midx && never evaluated: entry.midx == hook.midx | 0 |
2099 | entry.argumentMatch == hook.argumentMatch) { never evaluated: entry.argumentMatch == hook.argumentMatch | 0 |
2100 | // no need to compare the parameters if it's the same slot | - |
2101 | return true; // already there never executed: return true; | 0 |
2102 | } | - |
2103 | } executed: } Execution Count:51 | 51 |
2104 | | - |
2105 | connectSignal(key, hook); executed (the execution status of this line is deduced): connectSignal(key, hook); | - |
2106 | return true; executed: return true; Execution Count:205 | 205 |
2107 | } | - |
2108 | | - |
2109 | void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook &hook) | - |
2110 | { | - |
2111 | signalHooks.insertMulti(key, hook); executed (the execution status of this line is deduced): signalHooks.insertMulti(key, hook); | - |
2112 | connect(hook.obj, SIGNAL(destroyed(QObject*)), SLOT(objectDestroyed(QObject*)), executed (the execution status of this line is deduced): connect(hook.obj, "2""destroyed(QObject*)", "1""objectDestroyed(QObject*)", | - |
2113 | Qt::ConnectionType(Qt::DirectConnection | Qt::UniqueConnection)); executed (the execution status of this line is deduced): Qt::ConnectionType(Qt::DirectConnection | Qt::UniqueConnection)); | - |
2114 | | - |
2115 | MatchRefCountHash::iterator it = matchRefCounts.find(hook.matchRule); executed (the execution status of this line is deduced): MatchRefCountHash::iterator it = matchRefCounts.find(hook.matchRule); | - |
2116 | | - |
2117 | if (it != matchRefCounts.end()) { // Match already present evaluated: it != matchRefCounts.end() yes Evaluation Count:41 | yes Evaluation Count:199 |
| 41-199 |
2118 | it.value() = it.value() + 1; executed (the execution status of this line is deduced): it.value() = it.value() + 1; | - |
2119 | return; executed: return; Execution Count:41 | 41 |
2120 | } | - |
2121 | | - |
2122 | matchRefCounts.insert(hook.matchRule, 1); executed (the execution status of this line is deduced): matchRefCounts.insert(hook.matchRule, 1); | - |
2123 | | - |
2124 | if (connection) { partially evaluated: connection yes Evaluation Count:199 | no Evaluation Count:0 |
| 0-199 |
2125 | if (mode != QDBusConnectionPrivate::PeerMode) { evaluated: mode != QDBusConnectionPrivate::PeerMode yes Evaluation Count:116 | yes Evaluation Count:83 |
| 83-116 |
2126 | qDBusDebug("Adding rule: %s", hook.matchRule.constData()); executed: ; Execution Count:116 never executed: QMessageLogger("qdbusintegrator.cpp", 2126, __PRETTY_FUNCTION__).debug("Adding rule: %s", hook.matchRule.constData()); partially evaluated: !::isDebugging yes Evaluation Count:116 | no Evaluation Count:0 |
| 0-116 |
2127 | q_dbus_bus_add_match(connection, hook.matchRule, NULL); executed (the execution status of this line is deduced): q_dbus_bus_add_match(connection, hook.matchRule, __null); | - |
2128 | | - |
2129 | // Successfully connected the signal | - |
2130 | // Do we need to watch for this name? | - |
2131 | if (shouldWatchService(hook.service)) { evaluated: shouldWatchService(hook.service) yes Evaluation Count:21 | yes Evaluation Count:95 |
| 21-95 |
2132 | WatchedServicesHash::mapped_type &data = watchedServices[hook.service]; executed (the execution status of this line is deduced): WatchedServicesHash::mapped_type &data = watchedServices[hook.service]; | - |
2133 | if (++data.refcount == 1) { evaluated: ++data.refcount == 1 yes Evaluation Count:2 | yes Evaluation Count:19 |
| 2-19 |
2134 | // we need to watch for this service changing | - |
2135 | connectSignal(dbusServiceString(), QString(), dbusInterfaceString(), executed (the execution status of this line is deduced): connectSignal(dbusServiceString(), QString(), dbusInterfaceString(), | - |
2136 | QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), executed (the execution status of this line is deduced): QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), | - |
2137 | this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString))); executed (the execution status of this line is deduced): this, "1""serviceOwnerChangedNoLock(QString,QString,QString)"); | - |
2138 | data.owner = getNameOwnerNoCache(hook.service); executed (the execution status of this line is deduced): data.owner = getNameOwnerNoCache(hook.service); | - |
2139 | qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:" executed: ; Execution Count:2 never executed: QMessageLogger("qdbusintegrator.cpp", 2139, __PRETTY_FUNCTION__).debug() << this << "Watching service" << hook.service << "for owner changes (current owner:" << data.owner << ")"; partially evaluated: !::isDebugging yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2140 | << data.owner << ")"; never executed: QMessageLogger("qdbusintegrator.cpp", 2139, __PRETTY_FUNCTION__).debug() << this << "Watching service" << hook.service << "for owner changes (current owner:" << data.owner << ")"; | 0 |
2141 | } | - |
2142 | } executed: } Execution Count:21 | 21 |
2143 | } executed: } Execution Count:116 | 116 |
2144 | } executed: } Execution Count:199 | 199 |
2145 | } executed: } Execution Count:199 | 199 |
2146 | | - |
2147 | bool QDBusConnectionPrivate::disconnectSignal(const QString &service, | - |
2148 | const QString &path, const QString &interface, const QString &name, | - |
2149 | const QStringList &argumentMatch, const QString &signature, | - |
2150 | QObject *receiver, const char *slot) | - |
2151 | { | - |
2152 | // check the slot | - |
2153 | QDBusConnectionPrivate::SignalHook hook; executed (the execution status of this line is deduced): QDBusConnectionPrivate::SignalHook hook; | - |
2154 | QString key; executed (the execution status of this line is deduced): QString key; | - |
2155 | QString name2 = name; executed (the execution status of this line is deduced): QString name2 = name; | - |
2156 | if (name2.isNull()) partially evaluated: name2.isNull() no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
2157 | name2.detach(); never executed: name2.detach(); | 0 |
2158 | | - |
2159 | hook.signature = signature; executed (the execution status of this line is deduced): hook.signature = signature; | - |
2160 | if (!prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false)) evaluated: !prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false) yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
2161 | return false; // don't disconnect executed: return false; Execution Count:2 | 2 |
2162 | | - |
2163 | // avoid duplicating: | - |
2164 | QDBusConnectionPrivate::SignalHookHash::Iterator it = signalHooks.find(key); executed (the execution status of this line is deduced): QDBusConnectionPrivate::SignalHookHash::Iterator it = signalHooks.find(key); | - |
2165 | QDBusConnectionPrivate::SignalHookHash::Iterator end = signalHooks.end(); executed (the execution status of this line is deduced): QDBusConnectionPrivate::SignalHookHash::Iterator end = signalHooks.end(); | - |
2166 | for ( ; it != end && it.key() == key; ++it) { partially evaluated: it != end yes Evaluation Count:5 | no Evaluation Count:0 |
partially evaluated: it.key() == key yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
2167 | const QDBusConnectionPrivate::SignalHook &entry = it.value(); executed (the execution status of this line is deduced): const QDBusConnectionPrivate::SignalHook &entry = it.value(); | - |
2168 | if (entry.service == hook.service && partially evaluated: entry.service == hook.service yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
2169 | entry.path == hook.path && partially evaluated: entry.path == hook.path yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
2170 | entry.signature == hook.signature && partially evaluated: entry.signature == hook.signature yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
2171 | entry.obj == hook.obj && partially evaluated: entry.obj == hook.obj yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
2172 | entry.midx == hook.midx && partially evaluated: entry.midx == hook.midx yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
2173 | entry.argumentMatch == hook.argumentMatch) { partially evaluated: entry.argumentMatch == hook.argumentMatch yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
2174 | // no need to compare the parameters if it's the same slot | - |
2175 | disconnectSignal(it); executed (the execution status of this line is deduced): disconnectSignal(it); | - |
2176 | return true; // it was there executed: return true; Execution Count:5 | 5 |
2177 | } | - |
2178 | } | 0 |
2179 | | - |
2180 | // the slot was not found | - |
2181 | return false; never executed: return false; | 0 |
2182 | } | - |
2183 | | - |
2184 | QDBusConnectionPrivate::SignalHookHash::Iterator | - |
2185 | QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it) | - |
2186 | { | - |
2187 | const SignalHook &hook = it.value(); executed (the execution status of this line is deduced): const SignalHook &hook = it.value(); | - |
2188 | | - |
2189 | bool erase = false; executed (the execution status of this line is deduced): bool erase = false; | - |
2190 | MatchRefCountHash::iterator i = matchRefCounts.find(hook.matchRule); executed (the execution status of this line is deduced): MatchRefCountHash::iterator i = matchRefCounts.find(hook.matchRule); | - |
2191 | if (i == matchRefCounts.end()) { partially evaluated: i == matchRefCounts.end() no Evaluation Count:0 | yes Evaluation Count:215 |
| 0-215 |
2192 | qWarning("QDBusConnectionPrivate::disconnectSignal: MatchRule not found in matchRefCounts!!"); never executed (the execution status of this line is deduced): QMessageLogger("qdbusintegrator.cpp", 2192, __PRETTY_FUNCTION__).warning("QDBusConnectionPrivate::disconnectSignal: MatchRule not found in matchRefCounts!!"); | - |
2193 | } else { | 0 |
2194 | if (i.value() == 1) { evaluated: i.value() == 1 yes Evaluation Count:197 | yes Evaluation Count:18 |
| 18-197 |
2195 | erase = true; executed (the execution status of this line is deduced): erase = true; | - |
2196 | matchRefCounts.erase(i); executed (the execution status of this line is deduced): matchRefCounts.erase(i); | - |
2197 | } executed: } Execution Count:197 | 197 |
2198 | else { | - |
2199 | i.value() = i.value() - 1; executed (the execution status of this line is deduced): i.value() = i.value() - 1; | - |
2200 | } executed: } Execution Count:18 | 18 |
2201 | } | - |
2202 | | - |
2203 | // we don't care about errors here | - |
2204 | if (connection && erase) { partially evaluated: connection yes Evaluation Count:215 | no Evaluation Count:0 |
evaluated: erase yes Evaluation Count:197 | yes Evaluation Count:18 |
| 0-215 |
2205 | if (mode != QDBusConnectionPrivate::PeerMode) { evaluated: mode != QDBusConnectionPrivate::PeerMode yes Evaluation Count:114 | yes Evaluation Count:83 |
| 83-114 |
2206 | qDBusDebug("Removing rule: %s", hook.matchRule.constData()); executed: ; Execution Count:114 never executed: QMessageLogger("qdbusintegrator.cpp", 2206, __PRETTY_FUNCTION__).debug("Removing rule: %s", hook.matchRule.constData()); partially evaluated: !::isDebugging yes Evaluation Count:114 | no Evaluation Count:0 |
| 0-114 |
2207 | q_dbus_bus_remove_match(connection, hook.matchRule, NULL); executed (the execution status of this line is deduced): q_dbus_bus_remove_match(connection, hook.matchRule, __null); | - |
2208 | | - |
2209 | // Successfully disconnected the signal | - |
2210 | // Were we watching for this name? | - |
2211 | WatchedServicesHash::Iterator sit = watchedServices.find(hook.service); executed (the execution status of this line is deduced): WatchedServicesHash::Iterator sit = watchedServices.find(hook.service); | - |
2212 | if (sit != watchedServices.end()) { evaluated: sit != watchedServices.end() yes Evaluation Count:19 | yes Evaluation Count:95 |
| 19-95 |
2213 | if (--sit.value().refcount == 0) { evaluated: --sit.value().refcount == 0 yes Evaluation Count:2 | yes Evaluation Count:17 |
| 2-17 |
2214 | watchedServices.erase(sit); executed (the execution status of this line is deduced): watchedServices.erase(sit); | - |
2215 | disconnectSignal(dbusServiceString(), QString(), dbusInterfaceString(), executed (the execution status of this line is deduced): disconnectSignal(dbusServiceString(), QString(), dbusInterfaceString(), | - |
2216 | QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), executed (the execution status of this line is deduced): QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), | - |
2217 | this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); executed (the execution status of this line is deduced): this, "1""_q_serviceOwnerChanged(QString,QString,QString)"); | - |
2218 | } executed: } Execution Count:2 | 2 |
2219 | } executed: } Execution Count:19 | 19 |
2220 | } executed: } Execution Count:114 | 114 |
2221 | | - |
2222 | } executed: } Execution Count:197 | 197 |
2223 | | - |
2224 | return signalHooks.erase(it); executed: return signalHooks.erase(it); Execution Count:215 | 215 |
2225 | } | - |
2226 | | - |
2227 | void QDBusConnectionPrivate::registerObject(const ObjectTreeNode *node) | - |
2228 | { | - |
2229 | connect(node->obj, SIGNAL(destroyed(QObject*)), SLOT(objectDestroyed(QObject*)), executed (the execution status of this line is deduced): connect(node->obj, "2""destroyed(QObject*)", "1""objectDestroyed(QObject*)", | - |
2230 | Qt::DirectConnection); executed (the execution status of this line is deduced): Qt::DirectConnection); | - |
2231 | | - |
2232 | if (node->flags & (QDBusConnection::ExportAdaptors evaluated: node->flags & (QDBusConnection::ExportAdaptors | QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportNonScriptableSignals) yes Evaluation Count:72 | yes Evaluation Count:54 |
| 54-72 |
2233 | | QDBusConnection::ExportScriptableSignals evaluated: node->flags & (QDBusConnection::ExportAdaptors | QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportNonScriptableSignals) yes Evaluation Count:72 | yes Evaluation Count:54 |
| 54-72 |
2234 | | QDBusConnection::ExportNonScriptableSignals)) { evaluated: node->flags & (QDBusConnection::ExportAdaptors | QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportNonScriptableSignals) yes Evaluation Count:72 | yes Evaluation Count:54 |
| 54-72 |
2235 | QDBusAdaptorConnector *connector = qDBusCreateAdaptorConnector(node->obj); executed (the execution status of this line is deduced): QDBusAdaptorConnector *connector = qDBusCreateAdaptorConnector(node->obj); | - |
2236 | | - |
2237 | if (node->flags & (QDBusConnection::ExportScriptableSignals evaluated: node->flags & (QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportNonScriptableSignals) yes Evaluation Count:22 | yes Evaluation Count:50 |
| 22-50 |
2238 | | QDBusConnection::ExportNonScriptableSignals)) { evaluated: node->flags & (QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportNonScriptableSignals) yes Evaluation Count:22 | yes Evaluation Count:50 |
| 22-50 |
2239 | connector->disconnectAllSignals(node->obj); executed (the execution status of this line is deduced): connector->disconnectAllSignals(node->obj); | - |
2240 | connector->connectAllSignals(node->obj); executed (the execution status of this line is deduced): connector->connectAllSignals(node->obj); | - |
2241 | } executed: } Execution Count:22 | 22 |
2242 | | - |
2243 | // disconnect and reconnect to avoid duplicates | - |
2244 | connector->disconnect(SIGNAL(relaySignal(QObject*,const QMetaObject*,int,QVariantList)), executed (the execution status of this line is deduced): connector->disconnect("2""relaySignal(QObject*,const QMetaObject*,int,QVariantList)", | - |
2245 | this, SLOT(relaySignal(QObject*,const QMetaObject*,int,QVariantList))); executed (the execution status of this line is deduced): this, "1""relaySignal(QObject*,const QMetaObject*,int,QVariantList)"); | - |
2246 | connect(connector, SIGNAL(relaySignal(QObject*,const QMetaObject*,int,QVariantList)), executed (the execution status of this line is deduced): connect(connector, "2""relaySignal(QObject*,const QMetaObject*,int,QVariantList)", | - |
2247 | this, SLOT(relaySignal(QObject*,const QMetaObject*,int,QVariantList)), executed (the execution status of this line is deduced): this, "1""relaySignal(QObject*,const QMetaObject*,int,QVariantList)", | - |
2248 | Qt::DirectConnection); executed (the execution status of this line is deduced): Qt::DirectConnection); | - |
2249 | } executed: } Execution Count:72 | 72 |
2250 | } executed: } Execution Count:126 | 126 |
2251 | | - |
2252 | void QDBusConnectionPrivate::connectRelay(const QString &service, | - |
2253 | const QString &path, const QString &interface, | - |
2254 | QDBusAbstractInterface *receiver, | - |
2255 | const QMetaMethod &signal) | - |
2256 | { | - |
2257 | // this function is called by QDBusAbstractInterface when one of its signals is connected | - |
2258 | // we set up a relay from D-Bus into it | - |
2259 | SignalHook hook; executed (the execution status of this line is deduced): SignalHook hook; | - |
2260 | QString key; executed (the execution status of this line is deduced): QString key; | - |
2261 | | - |
2262 | QByteArray sig; executed (the execution status of this line is deduced): QByteArray sig; | - |
2263 | sig.append(QSIGNAL_CODE + '0'); executed (the execution status of this line is deduced): sig.append(2 + '0'); | - |
2264 | sig.append(signal.methodSignature()); executed (the execution status of this line is deduced): sig.append(signal.methodSignature()); | - |
2265 | if (!prepareHook(hook, key, service, path, interface, QString(), QStringList(), receiver, sig, partially evaluated: !prepareHook(hook, key, service, path, interface, QString(), QStringList(), receiver, sig, QDBusAbstractInterface::staticMetaObject.methodCount(), true) no Evaluation Count:0 | yes Evaluation Count:54 |
| 0-54 |
2266 | QDBusAbstractInterface::staticMetaObject.methodCount(), true)) partially evaluated: !prepareHook(hook, key, service, path, interface, QString(), QStringList(), receiver, sig, QDBusAbstractInterface::staticMetaObject.methodCount(), true) no Evaluation Count:0 | yes Evaluation Count:54 |
| 0-54 |
2267 | return; // don't connect | 0 |
2268 | | - |
2269 | // add it to our list: | - |
2270 | QDBusWriteLocker locker(ConnectRelayAction, this); executed (the execution status of this line is deduced): QDBusWriteLocker locker(ConnectRelayAction, this); | - |
2271 | SignalHookHash::ConstIterator it = signalHooks.constFind(key); executed (the execution status of this line is deduced): SignalHookHash::ConstIterator it = signalHooks.constFind(key); | - |
2272 | SignalHookHash::ConstIterator end = signalHooks.constEnd(); executed (the execution status of this line is deduced): SignalHookHash::ConstIterator end = signalHooks.constEnd(); | - |
2273 | for ( ; it != end && it.key() == key; ++it) { evaluated: it != end yes Evaluation Count:30 | yes Evaluation Count:34 |
evaluated: it.key() == key yes Evaluation Count:29 | yes Evaluation Count:1 |
| 1-34 |
2274 | const SignalHook &entry = it.value(); executed (the execution status of this line is deduced): const SignalHook &entry = it.value(); | - |
2275 | if (entry.service == hook.service && evaluated: entry.service == hook.service yes Evaluation Count:27 | yes Evaluation Count:2 |
| 2-27 |
2276 | entry.path == hook.path && evaluated: entry.path == hook.path yes Evaluation Count:23 | yes Evaluation Count:4 |
| 4-23 |
2277 | entry.signature == hook.signature && partially evaluated: entry.signature == hook.signature yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-23 |
2278 | entry.obj == hook.obj && evaluated: entry.obj == hook.obj yes Evaluation Count:19 | yes Evaluation Count:4 |
| 4-19 |
2279 | entry.midx == hook.midx) partially evaluated: entry.midx == hook.midx yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-19 |
2280 | return; // already there, no need to re-add executed: return; Execution Count:19 | 19 |
2281 | } executed: } Execution Count:10 | 10 |
2282 | | - |
2283 | connectSignal(key, hook); executed (the execution status of this line is deduced): connectSignal(key, hook); | - |
2284 | } executed: } Execution Count:35 | 35 |
2285 | | - |
2286 | void QDBusConnectionPrivate::disconnectRelay(const QString &service, | - |
2287 | const QString &path, const QString &interface, | - |
2288 | QDBusAbstractInterface *receiver, | - |
2289 | const QMetaMethod &signal) | - |
2290 | { | - |
2291 | // this function is called by QDBusAbstractInterface when one of its signals is disconnected | - |
2292 | // we remove relay from D-Bus into it | - |
2293 | SignalHook hook; executed (the execution status of this line is deduced): SignalHook hook; | - |
2294 | QString key; executed (the execution status of this line is deduced): QString key; | - |
2295 | | - |
2296 | QByteArray sig; executed (the execution status of this line is deduced): QByteArray sig; | - |
2297 | sig.append(QSIGNAL_CODE + '0'); executed (the execution status of this line is deduced): sig.append(2 + '0'); | - |
2298 | sig.append(signal.methodSignature()); executed (the execution status of this line is deduced): sig.append(signal.methodSignature()); | - |
2299 | if (!prepareHook(hook, key, service, path, interface, QString(), QStringList(), receiver, sig, partially evaluated: !prepareHook(hook, key, service, path, interface, QString(), QStringList(), receiver, sig, QDBusAbstractInterface::staticMetaObject.methodCount(), true) no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
2300 | QDBusAbstractInterface::staticMetaObject.methodCount(), true)) partially evaluated: !prepareHook(hook, key, service, path, interface, QString(), QStringList(), receiver, sig, QDBusAbstractInterface::staticMetaObject.methodCount(), true) no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
2301 | return; // don't connect | 0 |
2302 | | - |
2303 | // remove it from our list: | - |
2304 | QDBusWriteLocker locker(DisconnectRelayAction, this); executed (the execution status of this line is deduced): QDBusWriteLocker locker(DisconnectRelayAction, this); | - |
2305 | SignalHookHash::Iterator it = signalHooks.find(key); executed (the execution status of this line is deduced): SignalHookHash::Iterator it = signalHooks.find(key); | - |
2306 | SignalHookHash::Iterator end = signalHooks.end(); executed (the execution status of this line is deduced): SignalHookHash::Iterator end = signalHooks.end(); | - |
2307 | for ( ; it != end && it.key() == key; ++it) { evaluated: it != end yes Evaluation Count:34 | yes Evaluation Count:1 |
partially evaluated: it.key() == key yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
2308 | const SignalHook &entry = it.value(); executed (the execution status of this line is deduced): const SignalHook &entry = it.value(); | - |
2309 | if (entry.service == hook.service && evaluated: entry.service == hook.service yes Evaluation Count:32 | yes Evaluation Count:2 |
| 2-32 |
2310 | entry.path == hook.path && partially evaluated: entry.path == hook.path yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
2311 | entry.signature == hook.signature && partially evaluated: entry.signature == hook.signature yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
2312 | entry.obj == hook.obj && partially evaluated: entry.obj == hook.obj yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
2313 | entry.midx == hook.midx) { partially evaluated: entry.midx == hook.midx yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
2314 | // found it | - |
2315 | disconnectSignal(it); executed (the execution status of this line is deduced): disconnectSignal(it); | - |
2316 | return; executed: return; Execution Count:32 | 32 |
2317 | } | - |
2318 | } executed: } Execution Count:2 | 2 |
2319 | | - |
2320 | qWarning("QDBusConnectionPrivate::disconnectRelay called for a signal that was not found"); executed (the execution status of this line is deduced): QMessageLogger("qdbusintegrator.cpp", 2320, __PRETTY_FUNCTION__).warning("QDBusConnectionPrivate::disconnectRelay called for a signal that was not found"); | - |
2321 | } executed: } Execution Count:1 | 1 |
2322 | | - |
2323 | QString QDBusConnectionPrivate::getNameOwner(const QString& serviceName) | - |
2324 | { | - |
2325 | if (QDBusUtil::isValidUniqueConnectionName(serviceName)) evaluated: QDBusUtil::isValidUniqueConnectionName(serviceName) yes Evaluation Count:109 | yes Evaluation Count:30 |
| 30-109 |
2326 | return serviceName; executed: return serviceName; Execution Count:109 | 109 |
2327 | if (!connection) partially evaluated: !connection no Evaluation Count:0 | yes Evaluation Count:30 |
| 0-30 |
2328 | return QString(); never executed: return QString(); | 0 |
2329 | | - |
2330 | { | - |
2331 | // acquire a read lock for the cache | - |
2332 | QReadLocker locker(&lock); executed (the execution status of this line is deduced): QReadLocker locker(&lock); | - |
2333 | WatchedServicesHash::ConstIterator it = watchedServices.constFind(serviceName); executed (the execution status of this line is deduced): WatchedServicesHash::ConstIterator it = watchedServices.constFind(serviceName); | - |
2334 | if (it != watchedServices.constEnd()) evaluated: it != watchedServices.constEnd() yes Evaluation Count:23 | yes Evaluation Count:7 |
| 7-23 |
2335 | return it->owner; executed: return it->owner; Execution Count:23 | 23 |
2336 | } | - |
2337 | | - |
2338 | // not cached | - |
2339 | return getNameOwnerNoCache(serviceName); executed: return getNameOwnerNoCache(serviceName); Execution Count:7 | 7 |
2340 | } | - |
2341 | | - |
2342 | QString QDBusConnectionPrivate::getNameOwnerNoCache(const QString &serviceName) | - |
2343 | { | - |
2344 | QDBusMessage msg = QDBusMessage::createMethodCall(dbusServiceString(), executed (the execution status of this line is deduced): QDBusMessage msg = QDBusMessage::createMethodCall(dbusServiceString(), | - |
2345 | QLatin1String(DBUS_PATH_DBUS), dbusInterfaceString(), executed (the execution status of this line is deduced): QLatin1String("/org/freedesktop/DBus"), dbusInterfaceString(), | - |
2346 | QLatin1String("GetNameOwner")); executed (the execution status of this line is deduced): QLatin1String("GetNameOwner")); | - |
2347 | QDBusMessagePrivate::setParametersValidated(msg, true); executed (the execution status of this line is deduced): QDBusMessagePrivate::setParametersValidated(msg, true); | - |
2348 | msg << serviceName; executed (the execution status of this line is deduced): msg << serviceName; | - |
2349 | QDBusMessage reply = sendWithReply(msg, QDBus::Block); executed (the execution status of this line is deduced): QDBusMessage reply = sendWithReply(msg, QDBus::Block); | - |
2350 | if (reply.type() == QDBusMessage::ReplyMessage) evaluated: reply.type() == QDBusMessage::ReplyMessage yes Evaluation Count:3 | yes Evaluation Count:6 |
| 3-6 |
2351 | return reply.arguments().at(0).toString(); executed: return reply.arguments().at(0).toString(); Execution Count:3 | 3 |
2352 | return QString(); executed: return QString(); Execution Count:6 | 6 |
2353 | } | - |
2354 | | - |
2355 | QDBusMetaObject * | - |
2356 | QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &path, | - |
2357 | const QString &interface, QDBusError &error) | - |
2358 | { | - |
2359 | // service must be a unique connection name | - |
2360 | if (!interface.isEmpty()) { evaluated: !interface.isEmpty() yes Evaluation Count:123 | yes Evaluation Count:5 |
| 5-123 |
2361 | QDBusReadLocker locker(FindMetaObject1Action, this); executed (the execution status of this line is deduced): QDBusReadLocker locker(FindMetaObject1Action, this); | - |
2362 | QDBusMetaObject *mo = cachedMetaObjects.value(interface, 0); executed (the execution status of this line is deduced): QDBusMetaObject *mo = cachedMetaObjects.value(interface, 0); | - |
2363 | if (mo) evaluated: mo yes Evaluation Count:40 | yes Evaluation Count:83 |
| 40-83 |
2364 | return mo; executed: return mo; Execution Count:40 | 40 |
2365 | } executed: } Execution Count:83 | 83 |
2366 | | - |
2367 | // introspect the target object | - |
2368 | QDBusMessage msg = QDBusMessage::createMethodCall(service, path, executed (the execution status of this line is deduced): QDBusMessage msg = QDBusMessage::createMethodCall(service, path, | - |
2369 | QLatin1String(DBUS_INTERFACE_INTROSPECTABLE), executed (the execution status of this line is deduced): QLatin1String("org.freedesktop.DBus.Introspectable"), | - |
2370 | QLatin1String("Introspect")); executed (the execution status of this line is deduced): QLatin1String("Introspect")); | - |
2371 | QDBusMessagePrivate::setParametersValidated(msg, true); executed (the execution status of this line is deduced): QDBusMessagePrivate::setParametersValidated(msg, true); | - |
2372 | | - |
2373 | QDBusMessage reply = sendWithReply(msg, QDBus::Block); executed (the execution status of this line is deduced): QDBusMessage reply = sendWithReply(msg, QDBus::Block); | - |
2374 | | - |
2375 | // it doesn't exist yet, we have to create it | - |
2376 | QDBusWriteLocker locker(FindMetaObject2Action, this); executed (the execution status of this line is deduced): QDBusWriteLocker locker(FindMetaObject2Action, this); | - |
2377 | QDBusMetaObject *mo = 0; executed (the execution status of this line is deduced): QDBusMetaObject *mo = 0; | - |
2378 | if (!interface.isEmpty()) evaluated: !interface.isEmpty() yes Evaluation Count:83 | yes Evaluation Count:5 |
| 5-83 |
2379 | mo = cachedMetaObjects.value(interface, 0); executed: mo = cachedMetaObjects.value(interface, 0); Execution Count:83 | 83 |
2380 | if (mo) partially evaluated: mo no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
2381 | // maybe it got created when we switched from read to write lock | - |
2382 | return mo; never executed: return mo; | 0 |
2383 | | - |
2384 | QString xml; executed (the execution status of this line is deduced): QString xml; | - |
2385 | if (reply.type() == QDBusMessage::ReplyMessage) { evaluated: reply.type() == QDBusMessage::ReplyMessage yes Evaluation Count:80 | yes Evaluation Count:8 |
| 8-80 |
2386 | if (reply.signature() == QLatin1String("s")) partially evaluated: reply.signature() == QLatin1String("s") yes Evaluation Count:80 | no Evaluation Count:0 |
| 0-80 |
2387 | // fetch the XML description | - |
2388 | xml = reply.arguments().at(0).toString(); executed: xml = reply.arguments().at(0).toString(); Execution Count:80 | 80 |
2389 | } else { executed: } Execution Count:80 | 80 |
2390 | error = QDBusError(reply); executed (the execution status of this line is deduced): error = QDBusError(reply); | - |
2391 | lastError = error; executed (the execution status of this line is deduced): lastError = error; | - |
2392 | if (reply.type() != QDBusMessage::ErrorMessage || error.type() != QDBusError::UnknownMethod) partially evaluated: reply.type() != QDBusMessage::ErrorMessage no Evaluation Count:0 | yes Evaluation Count:8 |
partially evaluated: error.type() != QDBusError::UnknownMethod yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
2393 | return 0; // error executed: return 0; Execution Count:8 | 8 |
2394 | } | 0 |
2395 | | - |
2396 | // release the lock and return | - |
2397 | QDBusMetaObject *result = QDBusMetaObject::createMetaObject(interface, xml, executed (the execution status of this line is deduced): QDBusMetaObject *result = QDBusMetaObject::createMetaObject(interface, xml, | - |
2398 | cachedMetaObjects, error); executed (the execution status of this line is deduced): cachedMetaObjects, error); | - |
2399 | lastError = error; executed (the execution status of this line is deduced): lastError = error; | - |
2400 | return result; executed: return result; Execution Count:80 | 80 |
2401 | } | - |
2402 | | - |
2403 | void QDBusConnectionPrivate::registerService(const QString &serviceName) | - |
2404 | { | - |
2405 | QDBusWriteLocker locker(RegisterServiceAction, this); executed (the execution status of this line is deduced): QDBusWriteLocker locker(RegisterServiceAction, this); | - |
2406 | registerServiceNoLock(serviceName); executed (the execution status of this line is deduced): registerServiceNoLock(serviceName); | - |
2407 | } executed: } Execution Count:17 | 17 |
2408 | | - |
2409 | void QDBusConnectionPrivate::registerServiceNoLock(const QString &serviceName) | - |
2410 | { | - |
2411 | serviceNames.append(serviceName); executed (the execution status of this line is deduced): serviceNames.append(serviceName); | - |
2412 | } executed: } Execution Count:46 | 46 |
2413 | | - |
2414 | void QDBusConnectionPrivate::unregisterService(const QString &serviceName) | - |
2415 | { | - |
2416 | QDBusWriteLocker locker(UnregisterServiceAction, this); executed (the execution status of this line is deduced): QDBusWriteLocker locker(UnregisterServiceAction, this); | - |
2417 | unregisterServiceNoLock(serviceName); executed (the execution status of this line is deduced): unregisterServiceNoLock(serviceName); | - |
2418 | } executed: } Execution Count:4 | 4 |
2419 | | - |
2420 | void QDBusConnectionPrivate::unregisterServiceNoLock(const QString &serviceName) | - |
2421 | { | - |
2422 | serviceNames.removeAll(serviceName); executed (the execution status of this line is deduced): serviceNames.removeAll(serviceName); | - |
2423 | } executed: } Execution Count:12 | 12 |
2424 | | - |
2425 | bool QDBusConnectionPrivate::isServiceRegisteredByThread(const QString &serviceName) const | - |
2426 | { | - |
2427 | if (!serviceName.isEmpty() && serviceName == baseService) evaluated: !serviceName.isEmpty() yes Evaluation Count:1527 | yes Evaluation Count:313 |
evaluated: serviceName == baseService yes Evaluation Count:356 | yes Evaluation Count:1171 |
| 313-1527 |
2428 | return true; executed: return true; Execution Count:356 | 356 |
2429 | QStringList copy = serviceNames; executed (the execution status of this line is deduced): QStringList copy = serviceNames; | - |
2430 | return copy.contains(serviceName); executed: return copy.contains(serviceName); Execution Count:1484 | 1484 |
2431 | } | - |
2432 | | - |
2433 | void QDBusConnectionPrivate::postEventToThread(int action, QObject *object, QEvent *ev) | - |
2434 | { | - |
2435 | QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforePost, this); executed (the execution status of this line is deduced): QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforePost, this); | - |
2436 | QCoreApplication::postEvent(object, ev); executed (the execution status of this line is deduced): QCoreApplication::postEvent(object, ev); | - |
2437 | QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterPost, this); executed (the execution status of this line is deduced): QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterPost, this); | - |
2438 | } executed: } Execution Count:175 | 175 |
2439 | | - |
2440 | QT_END_NAMESPACE | - |
2441 | | - |
2442 | #endif // QT_NO_DBUS | - |
2443 | | - |
| | |