From 7fd6d65393fed2eda5e34bf802b8abfdb9f27fb9 Mon Sep 17 00:00:00 2001 From: "naving%netscape.com" Date: Fri, 14 Jun 2002 01:40:54 +0000 Subject: [PATCH] 150716 patch by bienvenu and darin. r=dougt sr=bienvenu. make compact folders work again. The fix is to clear all the member variables pertaining to the request before calling OnStopRequest --- netwerk/base/src/nsFileTransport.cpp | 46 +++++++++++++--------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/netwerk/base/src/nsFileTransport.cpp b/netwerk/base/src/nsFileTransport.cpp index 9413eddd6cc4..9dc45629046d 100644 --- a/netwerk/base/src/nsFileTransport.cpp +++ b/netwerk/base/src/nsFileTransport.cpp @@ -852,25 +852,24 @@ nsFileTransport::Process(nsIProgressEventSink *progressSink) NS_ConvertASCIItoUCS2(mStreamName).get()); } + // see http://bugzilla.mozilla.org/show_bug.cgi?id=139556#c64 + // for the reason behind this evil reference counting. + nsISupports* doomed = mContext.get(); + NS_IF_ADDREF(doomed); + mContext = 0; if (mListener) { - mListener->OnStopRequest(this, mContext, mStatus); + nsCOMPtr listener = do_QueryInterface(mListener); mListener = 0; + listener->OnStopRequest(this, doomed, mStatus); } // if we have a context, we have to ensure that it is released on the // proper thread. - if (mContext) { - if (mEventQ) { - // see http://bugzilla.mozilla.org/show_bug.cgi?id=139556#c64 - // for the reason behind this evil reference counting. - nsISupports* doomed = mContext.get(); - NS_ADDREF(doomed); - mContext = 0; + if (doomed) { + if (mEventQ) NS_ProxyRelease(mEventQ, doomed); - } - else { - mContext = nsnull; - } + else + NS_IF_RELEASE(doomed); } break; } @@ -1039,25 +1038,24 @@ nsFileTransport::Process(nsIProgressEventSink *progressSink) NS_NET_STATUS_WROTE_TO, NS_ConvertASCIItoUCS2(mStreamName).get()); + // see http://bugzilla.mozilla.org/show_bug.cgi?id=139556#c64 + // for the reason behind this evil reference counting. + nsISupports* doomed = mContext.get(); + NS_ADDREF(doomed); + mContext = 0; if (mProvider) { - mProvider->OnStopRequest(this, mContext, mStatus); + nsCOMPtr provider = do_QueryInterface(mProvider); mProvider = 0; + provider->OnStopRequest(this, doomed, mStatus); } // if we have a context, we have to ensure that it is released on the // proper thread. - if (mContext) { - if (mEventQ) { - // see http://bugzilla.mozilla.org/show_bug.cgi?id=139556#c64 - // for the reason behind this evil reference counting. - nsISupports* doomed = mContext.get(); - NS_ADDREF(doomed); - mContext = 0; + if (doomed) { + if (mEventQ) NS_ProxyRelease(mEventQ, doomed); - } - else { - mContext = nsnull; - } + else + NS_RELEASE(doomed); } mXferState = CLOSING; break;