src/network/access/qhttpnetworkconnectionchannel.cpp
changeset 23 89e065397ea6
parent 22 79de32ba3296
child 25 e24348a560a6
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp	Fri May 14 16:40:13 2010 +0300
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp	Thu May 27 13:40:48 2010 +0300
@@ -285,8 +285,8 @@
         }
 
         // HTTP pipelining
-        //connection->d_func()->fillPipeline(socket);
-        //socket->flush();
+        connection->d_func()->fillPipeline(socket);
+        socket->flush();
 
         // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called
         // this is needed if the sends an reply before we have finished sending the request. In that
@@ -317,6 +317,13 @@
         return;
     }
 
+    // only run when the QHttpNetworkConnection is not currently being destructed, e.g.
+    // this function is called from _q_disconnected which is called because
+    // of ~QHttpNetworkConnectionPrivate
+    if (!qobject_cast<QHttpNetworkConnection*>(connection)) {
+        return;
+    }
+
     qint64 bytes = 0;
     QAbstractSocket::SocketState socketState = socket->state();
 
@@ -384,7 +391,7 @@
                 if (!replyPrivate->expectContent()) {
                     replyPrivate->state = QHttpNetworkReplyPrivate::AllDoneState;
                     allDone();
-                    return;
+                    break;
                 }
             }
             break;