зеркало из https://github.com/mozilla/gecko-dev.git
Fixed bug #1159. Reference counting bug related to forms...
This commit is contained in:
Родитель
ed1c1a17a7
Коммит
c8ca4c5060
|
@ -2199,17 +2199,23 @@ nsHTMLDocument::AddForm(nsIDOMHTMLFormElement *aForm)
|
||||||
if (nsnull == aForm) {
|
if (nsnull == aForm) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
if (!mForms) {
|
|
||||||
nsIDOMHTMLCollection* forms = nsnull;
|
|
||||||
GetForms(&forms);
|
|
||||||
}
|
|
||||||
nsIContent* iContent = nsnull;
|
nsIContent* iContent = nsnull;
|
||||||
nsresult result = aForm->QueryInterface(kIContentIID, (void**)&iContent);
|
nsresult result = aForm->QueryInterface(kIContentIID, (void**)&iContent);
|
||||||
if ((NS_OK == result) && iContent) {
|
if ((NS_OK == result) && iContent) {
|
||||||
if (mForms->Add(iContent)) {
|
nsIDOMHTMLCollection* forms = nsnull;
|
||||||
NS_RELEASE(iContent);
|
|
||||||
return NS_OK;
|
// Initialize mForms if necessary...
|
||||||
|
if (nsnull == mForms) {
|
||||||
|
nsIDOMHTMLCollection* forms = nsnull;
|
||||||
|
result = GetForms(&forms);
|
||||||
|
NS_IF_RELEASE(forms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(result)) {
|
||||||
|
mForms->Add(iContent);
|
||||||
|
}
|
||||||
|
NS_RELEASE(iContent);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2223,6 +2229,7 @@ nsHTMLDocument::GetForms(nsIDOMHTMLCollection** aForms)
|
||||||
if (nsnull == mForms) {
|
if (nsnull == mForms) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
NS_ADDREF(mForms);
|
||||||
}
|
}
|
||||||
|
|
||||||
*aForms = (nsIDOMHTMLCollection *)mForms;
|
*aForms = (nsIDOMHTMLCollection *)mForms;
|
||||||
|
|
|
@ -2199,17 +2199,23 @@ nsHTMLDocument::AddForm(nsIDOMHTMLFormElement *aForm)
|
||||||
if (nsnull == aForm) {
|
if (nsnull == aForm) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
if (!mForms) {
|
|
||||||
nsIDOMHTMLCollection* forms = nsnull;
|
|
||||||
GetForms(&forms);
|
|
||||||
}
|
|
||||||
nsIContent* iContent = nsnull;
|
nsIContent* iContent = nsnull;
|
||||||
nsresult result = aForm->QueryInterface(kIContentIID, (void**)&iContent);
|
nsresult result = aForm->QueryInterface(kIContentIID, (void**)&iContent);
|
||||||
if ((NS_OK == result) && iContent) {
|
if ((NS_OK == result) && iContent) {
|
||||||
if (mForms->Add(iContent)) {
|
nsIDOMHTMLCollection* forms = nsnull;
|
||||||
NS_RELEASE(iContent);
|
|
||||||
return NS_OK;
|
// Initialize mForms if necessary...
|
||||||
|
if (nsnull == mForms) {
|
||||||
|
nsIDOMHTMLCollection* forms = nsnull;
|
||||||
|
result = GetForms(&forms);
|
||||||
|
NS_IF_RELEASE(forms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(result)) {
|
||||||
|
mForms->Add(iContent);
|
||||||
|
}
|
||||||
|
NS_RELEASE(iContent);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2223,6 +2229,7 @@ nsHTMLDocument::GetForms(nsIDOMHTMLCollection** aForms)
|
||||||
if (nsnull == mForms) {
|
if (nsnull == mForms) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
NS_ADDREF(mForms);
|
||||||
}
|
}
|
||||||
|
|
||||||
*aForms = (nsIDOMHTMLCollection *)mForms;
|
*aForms = (nsIDOMHTMLCollection *)mForms;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче