From 5eb1ca5d76caef1d87d780d9951eca425610f25b Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Tue, 16 Dec 2014 09:18:02 -0800 Subject: [PATCH] Bug 1064439, part 15 - Convert nsWebBrowser::mListenerArray to an nsAutoPtr. r=jst --- embedding/browser/nsWebBrowser.cpp | 6 +----- embedding/browser/nsWebBrowser.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/embedding/browser/nsWebBrowser.cpp b/embedding/browser/nsWebBrowser.cpp index e77ea884e8cb..b43503475ff1 100644 --- a/embedding/browser/nsWebBrowser.cpp +++ b/embedding/browser/nsWebBrowser.cpp @@ -76,8 +76,7 @@ nsWebBrowser::nsWebBrowser() : mPersistCurrentState(nsIWebBrowserPersist::PERSIST_STATE_READY), mPersistResult(NS_OK), mPersistFlags(nsIWebBrowserPersist::PERSIST_FLAGS_NONE), - mParentWidget(nullptr), - mListenerArray(nullptr) + mParentWidget(nullptr) { mWWatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID); NS_ASSERTION(mWWatch, "failed to get WindowWatcher"); @@ -110,7 +109,6 @@ NS_IMETHODIMP nsWebBrowser::InternalDestroy() nsWebBrowserListenerState *state = mListenerArray->ElementAt(i); delete state; } - delete mListenerArray; mListenerArray = nullptr; } @@ -264,7 +262,6 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIWeakReference *aListener nsWebBrowserListenerState *state = mListenerArray->ElementAt(i); delete state; } - delete mListenerArray; mListenerArray = nullptr; } @@ -1188,7 +1185,6 @@ NS_IMETHODIMP nsWebBrowser::Create() nsWebBrowserListenerState *state = mListenerArray->ElementAt(i); delete state; } - delete mListenerArray; mListenerArray = nullptr; } diff --git a/embedding/browser/nsWebBrowser.h b/embedding/browser/nsWebBrowser.h index 79f94aa83206..51e248df143b 100644 --- a/embedding/browser/nsWebBrowser.h +++ b/embedding/browser/nsWebBrowser.h @@ -160,7 +160,7 @@ protected: //Weak Reference interfaces... nsIWidget* mParentWidget; - nsTArray* mListenerArray; + nsAutoPtr> mListenerArray; }; #endif /* nsWebBrowser_h__ */