Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
4.7.0
-
None
Description
QDBusConnection::sessionBus() and QDBusConnection::systemBus() are not thread safe.
When using the returned instances from different threads the following error message will spam the console and DBus communication breaks:
QObject::moveToThread: Current thread (0xffffc714) is not the object's thread (0x0).
The following code is to blame:
Q_GLOBAL_STATIC_WITH_ARGS(QDBusDefaultConnection, _q_sessionBus,
(QDBusConnection::SessionBus, _q_sessionBusName))
Q_GLOBAL_STATIC_WITH_ARGS(QDBusDefaultConnection, _q_systemBus,
(QDBusConnection::SystemBus, _q_systemBusName))
It causes all threads to share the same connection and interface objects.