Avoid emitting finished() before user can connect the signal
authorShane Kearns <ext-shane.2.kearns@nokia.com>
Fri, 4 May 2012 12:55:45 +0000 (13:55 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 9 May 2012 00:28:10 +0000 (02:28 +0200)
QNetworkSession::open can synchronously emit an error, therefore
we need to queue this.
Otherwise QNetworkReply::finished is emitted before the user has
had a chance to connect the signals.

Task-number: QTBUG-18824
Change-Id: I703d5e31d2934afafabdf0a77ea3aaf5336e8dec
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
src/network/access/qnetworkreplyhttpimpl.cpp

index 5486883..c9ec287 100644 (file)
@@ -1569,7 +1569,7 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
 
         if (session) {
             QObject::connect(session, SIGNAL(error(QNetworkSession::SessionError)),
-                             q, SLOT(_q_networkSessionFailed()));
+                             q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection);
 
             if (!session->isOpen()) {
                 session->setSessionProperty(QStringLiteral("ConnectInBackground"), isBackground);