summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusintegrator_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-01-19 22:29:33 -0800
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2016-01-25 07:32:04 +0000
commita1ba281a26d065d2e901b3a947a8517ec5790504 (patch)
tree6ba7e607ddc6ee393501cabe10b41188422ab5b3 /src/dbus/qdbusintegrator_p.h
parent5cac511908bc67b86e29b31350619488906a55a2 (diff)
Call out to QtDBus message spies in the main thread
Whenever there are spies installed, we call out to the main thread to call to the kded/kiod message spies. This allows the spy code to do just about anything, where previously it was restricted in what it could do to avoid deadlocking or triggering assertions if it recursed back into QDBusConnection code in the manager thread. After the spies are done, the message is re-inserted into the QDBusConnection processing pipeline. This commit moves the spy handling to after the check for disabled dispatching, as doing otherwise would mean the message could get postponed again for no good reason. It's also possible that the main thread isn't done installing the hooks, so waiting until the dispatching is enabled is a good idea. For simplicity, this commit also restricts spying to method calls only. Signals are no longer spyable. Change-Id: I3d11545be52c43119f0fffff142b0e9d447415c2 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/dbus/qdbusintegrator_p.h')
-rw-r--r--src/dbus/qdbusintegrator_p.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/dbus/qdbusintegrator_p.h b/src/dbus/qdbusintegrator_p.h
index 62106e4c0b..2bbebdf708 100644
--- a/src/dbus/qdbusintegrator_p.h
+++ b/src/dbus/qdbusintegrator_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtDBus module of the Qt Toolkit.
@@ -65,6 +66,7 @@
QT_BEGIN_NAMESPACE
class QDBusConnectionPrivate;
+class QDBusMessage;
// Really private structs used by qdbusintegrator.cpp
// Things that aren't used by any other file
@@ -133,6 +135,23 @@ private:
bool handled;
};
+class QDBusSpyCallEvent : public QMetaCallEvent
+{
+public:
+ typedef void (*Hook)(const QDBusMessage&);
+ QDBusSpyCallEvent(QDBusConnectionPrivate *cp, const QDBusConnection &c, const QDBusMessage &msg,
+ const Hook *hooks, int count)
+ : QMetaCallEvent(0, 0, Q_NULLPTR, cp, 0), conn(c), msg(msg), hooks(hooks), hookCount(count)
+ {}
+ ~QDBusSpyCallEvent();
+ void placeMetaCall(QObject *) Q_DECL_OVERRIDE;
+
+ QDBusConnection conn; // keeps the refcount in QDBusConnectionPrivate up
+ QDBusMessage msg;
+ const Hook *hooks;
+ int hookCount;
+};
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QDBusSlotCache)