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

qdbusviewer fails to properly call method with unsigned integer argument. (+patch)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P2: Important
    • None
    • 4.6.3, 4.7.1
    • D-Bus
    • None
    • Linux (Fedora 13, Ubuntu 8.04 & 10.10), GNOME

    Description

      qdbusviewer fails to properly call org.gnome.Rhythmbox.setElapsed

      How Reproducible:
      Every Time.

      Steps to Reproduce:

      1) Start Rhythmbox. Play a long song.

      2) Start qdbusviewer

      3) Start dbus-monitor --session

      4) Using qdbusviewer Invoke org.gnome.Rhythmbox.setElapsed with 10 as the first and only argument. The 10 represents 10 seconds.

      Expected Result:

      Song skips to 10 second mark and continues playing.

      Actual Result:

      No error indication from qdbusviewer (cough, cough).

      dbus-monitor reports:

      method call sender=:1.110 -> dest=org.gnome.Rhythmbox serial=84 path=/org/gnome/Rhythmbox/Player; interface=org.gnome.Rhythmbox.Player; member=setElapsed
      int32 10
      error sender=:1.102 -> dest=:1.110 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=84
      string "Method "setElapsed" with signature "i" on interface "org.gnome.Rhythmbox.Player" doesn't exist

      Additional info:

      This method can be invoked using d-feet and it works as expected.

      The error was reported earlier as QTBUG-2160 and QTBUG-14664.

      This time around, I am attaching dbus-monitor output listings that prove that while the client app
      describes the method as having a single unsigned argument, d-feet sets up the call correctly and qdbusviewer sets up the call with a single signed integer. When the error message comes back, qdbusviewer does not report it.

      The error is in the callMethod routine of "qdbusviewer.cpp".
      The code relies on the types of the argument values returned from
      the user input dialog box as a list of QVariants to build the DBUS message. For reasons unknown, the returned QVariant is of the type "int" rather than "uint".

      The following code corrects the error:

          // Special case - convert a value to a QDBusVariant if the
          // interface wants a variant
          for (int i = 0; i < args.count(); ++i) {
              if (types.at(i) == qMetaTypeId<QDBusVariant>())
                  args[i] = qVariantFromValue(QDBusVariant(args.at(i)));
              // Insure uint is used if uint is required.           //<<<<
              if (types.at(i) == QMetaType::type("uint"))           //<<<<
                  args[i] = QVariant((uint) args.at(i).toUInt(0));  //<<<<
          }
      

      The new code is marked with "//<<<<". The rest is to establish context.

      Attachments

        1. d-feet-Rhythmbox-dbus-monitor.txt
          74 kB
          James D Armstrong
        2. qdbusviewer-Rhythmbox-dbus-monitor.txt
          44 kB
          James D Armstrong
        3. QTBUG16529-v0.patch
          0.2 kB
          James D Armstrong
        4. snippet.txt
          0.4 kB
          James D Armstrong
        5. snippet2.txt
          0.5 kB
          James D Armstrong
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            jda2000 James D Armstrong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes