From 5635e216cbf97fdd79673dfac367e2fe1c1ba3b6 Mon Sep 17 00:00:00 2001 From: "sayrer@gmail.com" Date: Wed, 26 Sep 2007 00:36:01 -0700 Subject: [PATCH] Bug 396982. Location bar autocomplete leaks. Patch by Nickolay Ponomarev . r=sspitzer/sayrer, a=mconnor --- toolkit/components/places/src/nsNavHistory.h | 1 + .../places/src/nsNavHistoryAutoComplete.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/toolkit/components/places/src/nsNavHistory.h b/toolkit/components/places/src/nsNavHistory.h index 1ed0611d588..650b0c31802 100644 --- a/toolkit/components/places/src/nsNavHistory.h +++ b/toolkit/components/places/src/nsNavHistory.h @@ -591,6 +591,7 @@ protected: nsresult PerformAutoComplete(); nsresult StartAutoCompleteTimer(PRUint32 aMilliseconds); static void AutoCompleteTimerCallback(nsITimer* aTimer, void* aClosure); + void DoneSearching(); PRInt32 mExpireDays; diff --git a/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp b/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp index 186266beaac..9df379dc91e 100644 --- a/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp +++ b/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp @@ -241,8 +241,17 @@ nsNavHistory::PerformAutoComplete() mCurrentChunkEndTime -= AUTOCOMPLETE_SEARCH_CHUNK; rv = StartAutoCompleteTimer(AUTOCOMPLETE_SEARCH_TIMEOUT); NS_ENSURE_SUCCESS(rv, rv); + } else { + DoneSearching(); } - return rv; + return NS_OK; +} + +void +nsNavHistory::DoneSearching() +{ + mCurrentResult = nsnull; + mCurrentListener = nsnull; } // nsNavHistory::StartSearch @@ -412,7 +421,7 @@ nsNavHistory::StopSearch() mAutoCompleteTimer->Cancel(); mCurrentSearchString.Truncate(); - mCurrentListener = nsnull; + DoneSearching(); return NS_OK; }