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

Aborted QNetworkReply doesn't always issue finished() signal (although error() gets issued)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • Some future release
    • 5.2.1
    • Network: HTTP
    • None
    • linux x64

    Description

      I am making a url request, using QNetworkAccessManager's get() method.
      If i call networkaccessmanager->get() and then do abort() on the returned reply, sometimes QNetworkReply's signal finished() gets invoked (sometimes not), and error() always gets called. Both finished() and error() always have error code 5 ("Network Operation cancelled").
      See attached main.cpp (builds out-of-box, you just have to add network module to the .pro file).

      As you can see I am doing 4 GET requests in a row, then abort() all the requests, but i am getting finished() slot invoked only 3 times, and error() slot gets invoked 4 times
      finished() doesnt get invoked for the first GET url request.

      This can lead to a memory leak - since developers usually deleteLater() the QNetworkReply in the finished() slot, and this way some objects do not get deleted.

      Attachments

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

        Activity

          People

            peter-har Peter Hartmann
            tediumremedy Tedium Remedy
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes