Bug 1064230 - Thunderbird crashes during LDAP search, r=rkent, a=rkent
authorSuyash Agarwal <syshagarwal@gmail.com>
Wed, 25 Mar 2015 14:01:33 -0700
changeset 20149 828840c08caa70107f2d177575bbf497705b4225
parent 20148 4776fcd9d1d6481a9860a4caf5539e528bc5d08b
child 20150 c9e3a8dd1da4f9f14e3462aa6226f2f1f4e23e73
child 20152 77b4e831201530c245c4256ec408974013087b89
push id47
push userkent@caspia.com
push dateWed, 06 May 2015 20:10:36 +0000
treeherdercomm-esr31@828840c08caa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent, rkent
bugs1064230
Bug 1064230 - Thunderbird crashes during LDAP search, r=rkent, a=rkent
ldap/xpcom/src/nsLDAPConnection.cpp
--- a/ldap/xpcom/src/nsLDAPConnection.cpp
+++ b/ldap/xpcom/src/nsLDAPConnection.cpp
@@ -20,16 +20,17 @@
 #include "nsLDAPOperation.h"
 #include "nsILDAPErrors.h"
 #include "nsIClassInfoImpl.h"
 #include "nsILDAPURL.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "nsMemory.h"
 #include "nsLDAPUtils.h"
+#include "nsProxyRelease.h"
 
 using namespace mozilla;
 
 const char kConsoleServiceContractId[] = "@mozilla.org/consoleservice;1";
 const char kDNSServiceContractId[] = "@mozilla.org/network/dns-service;1";
 
 // constructor
 //
@@ -610,16 +611,22 @@ nsLDAPConnectionRunnable::nsLDAPConnecti
                                                    nsILDAPOperation *aOperation,
                                                    nsLDAPConnection *aConnection)
   : mOperationID(aOperationID),  mConnection(aConnection)
 {
 }
 
 nsLDAPConnectionRunnable::~nsLDAPConnectionRunnable()
 {
+  if (mConnection) {
+    nsCOMPtr<nsIThread> thread = do_GetMainThread();
+    nsILDAPConnection* forgettableConnection;
+    mConnection.forget(&forgettableConnection);
+    NS_ProxyRelease(thread, forgettableConnection, false);
+  }
 }
 
 NS_IMPL_ISUPPORTS(nsLDAPConnectionRunnable, nsIRunnable)
 
 NS_IMETHODIMP nsLDAPConnectionRunnable::Run()
 {
   if (!mOperationID) {
     NS_ERROR("mOperationID is null");