Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-11413

QDBusConnection::sessionBus() and QDBusConnection::systemBus() are not thread safe

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • Some future release
    • 4.7.0
    • D-Bus
    • 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.

      Attachments

        1. qtbug-11413.cpp
          1 kB
        2. qtbug-11413.pro
          0.1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tmacieir Thiago Macieira (closed Nokia identity) (Inactive)
            hasselmm Mathias Hasselmann
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes