Bug 616591. Fix crash due to http transactions trying to get connection info from the http pipeline while it's being closed. r=bzbarsky, a=blocker
authorHonza Bambas <honzab.moz@firemni.cz>
Wed, 08 Dec 2010 20:57:14 -0500
changeset 58921 4fccdd4bc023c116a4e4cdb43f1c04f2517349fd
parent 58920 3ad7ea863cc5f03f2773f67d63630c8dda079b04
child 58922 81aea2200c34b1af0be136acfacd7405ed41f58a
push id17467
push userbzbarsky@mozilla.com
push dateThu, 09 Dec 2010 01:57:47 +0000
treeherdermozilla-central@4fccdd4bc023 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky, blocker
bugs616591
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 616591. Fix crash due to http transactions trying to get connection info from the http pipeline while it's being closed. r=bzbarsky, a=blocker
netwerk/protocol/http/nsHttpPipeline.cpp
--- a/netwerk/protocol/http/nsHttpPipeline.cpp
+++ b/netwerk/protocol/http/nsHttpPipeline.cpp
@@ -497,19 +497,16 @@ nsHttpPipeline::Close(nsresult reason)
         LOG(("  already closed\n"));
         return;
     }
 
     // the connection is going away!
     mStatus = reason;
     mClosed = PR_TRUE;
 
-    // we must no longer reference the connection!
-    NS_IF_RELEASE(mConnection);
-
     PRUint32 i, count;
     nsAHttpTransaction *trans;
 
     // any pending requests can ignore this error and be restarted
     count = mRequestQ.Length();
     for (i=0; i<count; ++i) {
         trans = Request(i);
         trans->Close(NS_ERROR_NET_RESET);
@@ -531,16 +528,19 @@ nsHttpPipeline::Close(nsresult reason)
         count = mResponseQ.Length();
         for (i=1; i<count; ++i) {
             trans = Response(i);
             trans->Close(NS_ERROR_NET_RESET);
             NS_RELEASE(trans);
         }
         mResponseQ.Clear();
     }
+
+    // we must no longer reference the connection!
+    NS_IF_RELEASE(mConnection);
 }
 
 nsresult
 nsHttpPipeline::OnReadSegment(const char *segment,
                               PRUint32 count,
                               PRUint32 *countRead)
 {
     return mSendBufOut->Write(segment, count, countRead);