Fix a double delete on cancel as well as a crash with proxy
authorstaikos <staikos@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2007 08:57:13 +0000 (08:57 +0000)
committerstaikos <staikos@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2007 08:57:13 +0000 (08:57 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19296 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/network/qt/ResourceHandleManagerQt.cpp

index 7a788ddd44bf264d6868af867fa364bb866e9911..ed9d3cc570d657a369731f47a87652c93ec23fef 100644 (file)
@@ -1,3 +1,14 @@
+2007-01-31  George Staikos  <staikos@kde.org>
+
+        Reviewed by Zack and Lars.
+
+        Fix double delete on cancel as well as assertion with proxy.
+
+        * platform/network/qt/ResourceHandleManagerQt.cpp:
+        (WebCore::WebCoreHttp::getConnection):
+        (WebCore::WebCoreHttp::onRequestFinished):
+        (WebCore::WebCoreHttp::cancel):
+
 2007-01-31  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Oliver.
index 8f45dd5a7f16ccd65adcccbf1686e75edfef95bb..68c0b075b0d34f16ebc495f9480fb6c98c947e55 100644 (file)
@@ -517,7 +517,7 @@ int WebCoreHttp::getConnection()
         Q_ASSERT(o == connection[1].http);
         c = 1;
     }
-    Q_ASSERT(connection[c].current);
+    //Q_ASSERT(connection[c].current);
     return c;
 }
 
@@ -549,6 +549,10 @@ void WebCoreHttp::onRequestFinished(int, bool error)
 {
     int c = getConnection();
     RequestQt *req = connection[c].current;
+    if (!req) {
+        scheduleNextRequest();
+        return;
+    }
     QHttp *http = connection[c].http;
     DEBUG() << "WebCoreHttp::slotFinished connection=" << c << error << req;
 
@@ -578,14 +582,19 @@ void WebCoreHttp::onStateChanged(int state)
 
 void WebCoreHttp::cancel(RequestQt* request)
 {
+    bool doEmit = true;
     m_inCancel = true;
-    for (int i = 0; i < 2; ++i)
-        if (request == connection[i].current)
+    for (int i = 0; i < 2; ++i) {
+        if (request == connection[i].current) {
             connection[i].http->abort();
+            doEmit = false;
+        }
+    }
     m_pendingRequests.removeAll(request);
     m_inCancel = false;
 
-    emit m_loader->receivedFinished(request, 1);
+    if (doEmit)
+        emit m_loader->receivedFinished(request, 1);
 
     if (m_pendingRequests.isEmpty()
         && !connection[0].current && !connection[1].current)