Fixing leak of observers when notification of OnSubmit(). This fixes

walletservice from being leaked. r=pollmann
This commit is contained in:
dp%netscape.com 2000-02-08 05:31:08 +00:00
Родитель 36199b6f2e
Коммит 859cc763b0
1 изменённых файлов: 3 добавлений и 4 удалений

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

@ -549,13 +549,12 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame)
nsIEnumerator* theEnum;
result = service->EnumerateObserverList(theTopic.GetUnicode(), &theEnum);
if (NS_SUCCEEDED(result) && theEnum){
nsIFormSubmitObserver* formSubmitObserver;
nsISupports *inst;
nsCOMPtr<nsISupports> inst;
for (theEnum->First(); theEnum->IsDone() != NS_OK; theEnum->Next()) {
result = theEnum->CurrentItem(&inst);
result = theEnum->CurrentItem(getter_AddRefs(inst));
if (NS_SUCCEEDED(result) && inst) {
result = inst->QueryInterface(NS_GET_IID(nsIFormSubmitObserver),(void**)&formSubmitObserver);
nsCOMPtr<nsIFormSubmitObserver> formSubmitObserver = do_QueryInterface(inst, &result);
if (NS_SUCCEEDED(result) && formSubmitObserver) {
formSubmitObserver->Notify(mContent);
}