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

QDBusConnection::callWithCallback() fails if reply slot takes more than one argument

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.1.0
    • 4.7.4
    • D-Bus
    • None
    • Linux devel 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

    Description

      My application receives these errors:

      =======
      QFATAL : SsoTestClient::queryAvailableMetods() QDBusPendingReply: type void is not registered with QtDBus
      FAIL! : SsoTestClient::queryAvailableMetods() Received a fatal error.
      =======

      The code used to build fine in MeeGo / Harmattan, but now I'm testing some code on a 64bit machine; it may be that the issue is only reproducible on 64 bit environments.

      Near the end of QDBusPendingCallPrivate::setReplyCallback() there's this:

      =======
      // QList<int> is actually a vector
      // kids, don't try this at home
      setMetaTypes(count, count ? &metaTypes.at(1) : 0);
      =======

      When debugging, I saw that metaTypes contained three values: 0, 206 and 9. But the array received by setMetaTypes was 206, 0, 9 (but the length is 2, so the last number would be ignored) – that is, an element with value 0 appears in between of the array elements, causing the error above.
      I locally fixed the issue like this:

      =======
      @@ -180,9 +181,12 @@ bool QDBusPendingCallPrivate::setReplyCallback(QObject *target, const char *memb
      if (metaTypes.at(count) == QDBusMetaTypeId::message)
      --count;

      • // QList<int> is actually a vector
      • // kids, don't try this at home
      • setMetaTypes(count, count ? &metaTypes.at(1) : 0);
        + if (count == 0) { + setMetaTypes(count, 0); + }

        else

        { + QVector<int> types = QVector<int>::fromList(metaTypes); + setMetaTypes(count, types.constData() + 1); + }

        return true;
        }
        =======

      I'm going to propose the patch above for merging – but any hint on how to solve the problem from my application while the patch is not integrated into Qt will be greatly appreciated!

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            mardy Alberto Mardegan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes