From f5ef355afb65bec8c3de86d28b8ad223fedd2f6c Mon Sep 17 00:00:00 2001 From: "bienvenu%nventure.com" Date: Fri, 30 Jun 2006 21:29:07 +0000 Subject: [PATCH] fix crash when clearing search during quick ab search, r=standard8, sr=mscott 330507 --- mailnews/addrbook/src/nsAbLDAPDirectory.cpp | 1 + mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp | 2 ++ mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp index 9060eee303c..ee30abe13b2 100644 --- a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp +++ b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp @@ -464,6 +464,7 @@ nsresult nsAbLDAPDirectory::OnSearchFinished (PRInt32 result) nsAutoLock lock (mLock); mPerformingQuery = PR_FALSE; + mListener = nsnull; // break cycle with listener return NS_OK; } diff --git a/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp b/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp index 21e57da1d4b..5b1abd310b9 100644 --- a/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp +++ b/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp @@ -141,12 +141,14 @@ nsAbQueryLDAPMessageListener::nsAbQueryLDAPMessageListener ( mLock(0) { + NS_ADDREF(mDirectoryQuery); } nsAbQueryLDAPMessageListener::~nsAbQueryLDAPMessageListener () { if (mLock) PR_DestroyLock (mLock); + NS_RELEASE(mDirectoryQuery); } nsresult nsAbQueryLDAPMessageListener::Initiate () diff --git a/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h b/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h index 941d7d724e3..bb2f7315e99 100644 --- a/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h +++ b/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h @@ -74,9 +74,9 @@ protected: nsXPIDLCString mLogin; // authenticate to the LDAP server as... nsCOMPtr mDirectoryUrl; // the URL for the server PRUint32 mProtocolVersion; // version of LDAP (see nsILDAPConnection.idl) + nsCOMPtr mListener; private: - nsCOMPtr mListener; PRBool mInitialized; PRLock* mLock;