Bug 1328121 - Hold ref on mlistener when calling onstartrequest. r=smaug, r=jduell, a=jcristau
authorPatrick McManus <mcmanus@ducksong.com>
Tue, 03 Jan 2017 16:15:23 -0500
changeset 353518 0146e1addf3196ecb0301245ec4015aa8aeecd33
parent 353517 e7d445c74aa18b291897118cbeb5cc1c986b4f11
child 353519 c0ed1d46370d365f793f04751f7261b93b7f26a2
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, jduell, jcristau
bugs1328121
milestone52.0a2
Bug 1328121 - Hold ref on mlistener when calling onstartrequest. r=smaug, r=jduell, a=jcristau
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -1306,17 +1306,18 @@ nsHttpChannel::CallOnStartRequest()
           NS_ENSURE_SUCCESS(rv, rv);
         }
     }
 
     LOG(("  calling mListener->OnStartRequest\n"));
     if (mListener) {
         MOZ_ASSERT(!mOnStartRequestCalled,
                    "We should not call OsStartRequest twice");
-        rv = mListener->OnStartRequest(this, mListenerContext);
+        nsCOMPtr<nsIStreamListener> deleteProtector(mListener);
+        rv = deleteProtector->OnStartRequest(this, mListenerContext);
         mOnStartRequestCalled = true;
         if (NS_FAILED(rv))
             return rv;
     } else {
         NS_WARNING("OnStartRequest skipped because of null listener");
         mOnStartRequestCalled = true;
     }