Bug 1064439, part 15 - Convert nsWebBrowser::mListenerArray to an nsAutoPtr. r=jst

This commit is contained in:
Andrew McCreight 2014-12-16 09:18:02 -08:00
Родитель fab20cd349
Коммит 5eb1ca5d76
2 изменённых файлов: 2 добавлений и 6 удалений

Просмотреть файл

@ -76,8 +76,7 @@ nsWebBrowser::nsWebBrowser() :
mPersistCurrentState(nsIWebBrowserPersist::PERSIST_STATE_READY), mPersistCurrentState(nsIWebBrowserPersist::PERSIST_STATE_READY),
mPersistResult(NS_OK), mPersistResult(NS_OK),
mPersistFlags(nsIWebBrowserPersist::PERSIST_FLAGS_NONE), mPersistFlags(nsIWebBrowserPersist::PERSIST_FLAGS_NONE),
mParentWidget(nullptr), mParentWidget(nullptr)
mListenerArray(nullptr)
{ {
mWWatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID); mWWatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
NS_ASSERTION(mWWatch, "failed to get WindowWatcher"); NS_ASSERTION(mWWatch, "failed to get WindowWatcher");
@ -110,7 +109,6 @@ NS_IMETHODIMP nsWebBrowser::InternalDestroy()
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i); nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
delete state; delete state;
} }
delete mListenerArray;
mListenerArray = nullptr; mListenerArray = nullptr;
} }
@ -264,7 +262,6 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIWeakReference *aListener
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i); nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
delete state; delete state;
} }
delete mListenerArray;
mListenerArray = nullptr; mListenerArray = nullptr;
} }
@ -1188,7 +1185,6 @@ NS_IMETHODIMP nsWebBrowser::Create()
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i); nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
delete state; delete state;
} }
delete mListenerArray;
mListenerArray = nullptr; mListenerArray = nullptr;
} }

Просмотреть файл

@ -160,7 +160,7 @@ protected:
//Weak Reference interfaces... //Weak Reference interfaces...
nsIWidget* mParentWidget; nsIWidget* mParentWidget;
nsTArray<nsWebBrowserListenerState*>* mListenerArray; nsAutoPtr<nsTArray<nsWebBrowserListenerState*>> mListenerArray;
}; };
#endif /* nsWebBrowser_h__ */ #endif /* nsWebBrowser_h__ */