Bug 881413 - Avoid a race condition in HTTP shutdown by explicitly cancelling nsHttpConnectionMgr::mTimer when we shut down the socket thread, r=mcmanus
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 28 Feb 2014 16:40:38 -0800
changeset 171697 5d6a519d6108dfec609b15fbf57fada13e16ba7c
parent 171696 49d61a8f1e5c40e16d599a055e14f6371472e813
child 171698 8a261f24efc1b6c9d03fbffd388139432711a7fe
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersmcmanus
bugs881413
milestone30.0a1
Bug 881413 - Avoid a race condition in HTTP shutdown by explicitly cancelling nsHttpConnectionMgr::mTimer when we shut down the socket thread, r=mcmanus
netwerk/protocol/http/nsHttpConnectionMgr.cpp
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -2127,16 +2127,20 @@ nsHttpConnectionMgr::OnMsgShutdown(int32
 
     mCT.Enumerate(ShutdownPassCB, this);
 
     if (mTimeoutTick) {
         mTimeoutTick->Cancel();
         mTimeoutTick = nullptr;
         mTimeoutTickArmed = false;
     }
+    if (mTimer) {
+      mTimer->Cancel();
+      mTimer = nullptr;
+    }
 
     // signal shutdown complete
     nsRefPtr<nsIRunnable> runnable =
         new nsConnEvent(this, &nsHttpConnectionMgr::OnMsgShutdownConfirm,
                         0, param);
     NS_DispatchToMainThread(runnable);
 }