Bug 350873: nsStreamLoader code accessed on secondary thread [ASSERTION: nsStreamLoader not thread-safe]. r=kengert, sr=dveditz, b1.9=sayrer
authordcamp@mozilla.com
Thu, 21 Feb 2008 17:05:17 -0800
changeset 12058 b2108d83c12260f085c250641edec3e028c99cea
parent 12057 8353f51ec631fce113eee05c04b45e201a559932
child 12059 4bc9eda0f9900ffd90d24b10ab3d706ab6a818a9
push idunknown
push userunknown
push dateunknown
reviewerskengert, dveditz
bugs350873
milestone1.9b4pre
Bug 350873: nsStreamLoader code accessed on secondary thread [ASSERTION: nsStreamLoader not thread-safe]. r=kengert, sr=dveditz, b1.9=sayrer
security/manager/ssl/src/nsNSSCallbacks.cpp
--- a/security/manager/ssl/src/nsNSSCallbacks.cpp
+++ b/security/manager/ssl/src/nsNSSCallbacks.cpp
@@ -62,16 +62,17 @@
 #include "nsNSSShutDown.h"
 #include "nsIUploadChannel.h"
 #include "nsSSLThread.h"
 #include "nsThreadUtils.h"
 #include "nsAutoLock.h"
 #include "nsIThread.h"
 #include "nsIWindowWatcher.h"
 #include "nsIPrompt.h"
+#include "nsProxyRelease.h"
 
 #include "ssl.h"
 #include "cert.h"
 #include "ocsp.h"
 
 static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID);
 NSSCleanupAutoPtrClass(CERTCertificate, CERT_DestroyCertificate)
 
@@ -560,16 +561,21 @@ nsHTTPListener::~nsHTTPListener()
   if (mResponsibleForDoneSignal)
     send_done_signal();
 
   if (mCondition)
     PR_DestroyCondVar(mCondition);
   
   if (mLock)
     PR_DestroyLock(mLock);
+
+  if (mLoader) {
+    nsCOMPtr<nsIThread> mainThread(do_GetMainThread());
+    NS_ProxyRelease(mainThread, mLoader);
+  }
 }
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsHTTPListener, nsIStreamLoaderObserver)
 
 NS_IMETHODIMP
 nsHTTPListener::OnStreamComplete(nsIStreamLoader* aLoader,
                                  nsISupports* aContext,
                                  nsresult aStatus,