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

Bad code example regardin delayed replies in Declaring Slots in D-Bus Adaptors

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P2: Important
    • 4.8.x
    • 4.6.2
    • Documentation
    • None
    • Maemo 6

    Description

      The example code in http://doc.trolltech.com/4.6/qdbusdeclaringslots.html#delayed-replies has an error.
      According to my tests, one shouldn't send reply to D-Bus when setDelayedReply(true).

       QString processRequest(const QString &request, const QDBusMessage &message)
       {
           RequestData *data = new RequestData;
           data->request = request;
           message.setDelayedReply(true);
           data->reply = message.createReply();
           QDBusConnection::sessionBus().send(data->reply); // THIS LINE SHOULDN'T BE HERE
      
           appendRequest(data);
           return QString();
       }
      

      If you send reply in there, the reply goes to the caller and you can't reply later as intended.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            jasilvas Jari Silvasti (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes