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

QNetworkReplyFileImpl synchronously emits QNetworkReply::finished() from constructor in case of error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.11, 6.2.7, 6.5.0 Beta1
    • 5.15.5, 6.x
    • Network
    • None
    • All
    • 68f641095c (qt/qtbase/dev) 68f641095c (qt/tqtc-qtbase/dev) 678928f4af (qt/tqtc-qtbase/5.15) f2c00dd038 (qt/qtbase/6.4) f2c00dd038 (qt/tqtc-qtbase/6.4) 4a3a7ae6b8 (qt/tqtc-qtbase/6.2) 678928f4af (qt/tqtc-qtbase/5.15-vxworks)

    Description

      https://code.qt.io/cgit/qt/qtbase.git/tree/src/network/access/qnetworkreplyfileimpl.cpp?id=05fc3aef53348fb58be6308076e000825b704e58#n62

       QNetworkReplyFileImpl::QNetworkReplyFileImpl() calls fileOpenFinished(false) #if !defined(Q_OS_WIN) and if (!url.host().isEmpty()).

      QNetworkReplyFileImpl::fileOpenFinished() unconditionally emits finished().

      Other classes derived from QNetworkReply take care to not emit this signal directly from constructor, because the users cannot connect to a signal before the reply object is constructed. Is this a bug or is every QNetworkReply user supposed to check isFinished() after a network reply construction and not rely on finished() being emitted if it returns true? Also if the user code needs to destroy a network reply when finished, is calling deleteLater() on it safe as soon as isFinished() returns true, without waiting for the finished() signal?

      QNetworkReply's documentation could be improved to clarify these usage questions.

      Attachments

        For Gerrit Dashboard: QTBUG-105618
        # Subject Branch Project Status CR V

        Activity

          People

            manordheim Mårten Nordheim
            vedg Igor Kushnir
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes