Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5.3
-
None
-
be6644c1f (dev), 518ce19c7 (6.7), a64d1021d (6.6)
Description
This is actualised version of the QTBUG-36127, which is pretty old and seems forgotten.
See sample code:
#include <QtCore/QCoreApplication> #include <QtCore/QEventLoop> #include <QtCore/QTimer> #include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkReply> int main(int argc, char** argv) { int finishCount = 0; QCoreApplication app(argc, argv); QNetworkAccessManager network; QNetworkReply* reply = network.post(QNetworkRequest(QUrl("http://invalid-hostname")), QByteArray("foo bar")); QObject::connect(reply, &QNetworkReply::finished, reply, [&] { ++finishCount; }); reply->abort(); QEventLoop eventLoop; QTimer::singleShot(200, &eventLoop, &QEventLoop::quit); eventLoop.exec(); reply->deleteLater(); qWarning() << "Finish count" << finishCount; return 0; };
When aborting network request, e.g. by timeout, we can encounter several issues:
1. Internal Qt warning: "QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once."
2. finished() signal and corresponding slot might be called twice.
With the code sample above both problems are stably reproduced for me at least on macOS.
Attachments
Issue Links
- relates to
-
QTBUG-36127 Internal warning when aborting a QNetworkReply
- Closed
-
QTBUG-85248 Qt warning "QHttpNetworkConnectionPrivate::_q_hostLookupFinished could not de-queue request, failed to report HostNotFoundError"
- Closed
For Gerrit Dashboard: QTBUG-118209 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
545607,5 | Http: fix issues after early abort() | dev | qt/qtbase | Status: MERGED | +2 | 0 |
547228,2 | Http: fix issues after early abort() | 6.7 | qt/qtbase | Status: MERGED | +2 | 0 |
547571,3 | Http: fix issues after early abort() | 6.6 | qt/qtbase | Status: MERGED | +2 | 0 |