From a32217cb551612277d43b3f7c08da85abe3874ac Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Tue, 9 Aug 2016 17:01:37 +0300 Subject: QDBusServer: delay processing of D-Bus messages We must ensure that QDBusServer's newConnection() signal has been processed by the application, before starting processing messages on it. Task-number: QTBUG-55087 Change-Id: I595329b2f98788dbf9f40558b8c230c0c0817ef8 Reviewed-by: Timo Jyrinki Reviewed-by: Thiago Macieira --- src/dbus/qdbusconnection_p.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/dbus/qdbusconnection_p.h') diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index fff9f29b03..d16cd05058 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -375,6 +375,25 @@ extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNod const QDBusMessage &msg); extern QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg); + +// can be replaced with a lambda in Qt 5.7 +class QDBusConnectionDispatchEnabler : public QObject +{ + Q_OBJECT + QDBusConnectionPrivate *con; +public: + QDBusConnectionDispatchEnabler(QDBusConnectionPrivate *con) : con(con) {} + +public slots: + void execute() + { + con->setDispatchEnabled(true); + if (!con->ref.deref()) + con->deleteLater(); + deleteLater(); + } +}; + #endif // QT_BOOTSTRAPPED QT_END_NAMESPACE -- cgit v1.2.3