Fix leak statistics by logging all releases, and fix one extra release. r=pollmann@netscape.com

This commit is contained in:
dbaron%fas.harvard.edu 2000-03-18 21:35:22 +00:00
Родитель 914a800f54
Коммит 5b982b687a
14 изменённых файлов: 34 добавлений и 2 удалений

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

@ -183,6 +183,7 @@ nsHTMLButtonElement::Release()
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLButtonElement");
delete this;
return 0;
} else {
@ -525,11 +526,11 @@ nsHTMLButtonElement::SetForm(nsIDOMHTMLFormElement* aForm)
if (mForm && formControl)
mForm->RemoveElement(formControl, PR_TRUE);
NS_IF_RELEASE(mForm);
if (nsnull == aForm)
mForm = nsnull;
else {
NS_IF_RELEASE(mForm);
if (formControl) {
result = aForm->QueryInterface(kIFormIID, (void**)&mForm); // keep the ref
if ((NS_OK == result) && mForm) {

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

@ -124,11 +124,13 @@ NS_IMETHODIMP_(nsrefcnt)
nsHTMLFieldSetElement::Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFieldSetElement");
if (mRefCnt <= 0) {
delete this;
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFieldSetElement");
delete this;
return 0;
} else {

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

@ -253,7 +253,14 @@ nsHTMLFormElement::Release()
PRUint32 numChildren;
GetElementCount(&numChildren);
if (mRefCnt == nsrefcnt(numChildren)) {
#ifdef NS_BUILD_REFCNT_LOGGING
while(mRefCnt > 0) {
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFormElement");
}
#else
mRefCnt = 0;
#endif
delete this;
return 0;
}

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

@ -306,6 +306,7 @@ nsHTMLInputElement::Release()
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLInputElement");
delete this;
return 0;
} else {

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

@ -134,11 +134,13 @@ NS_IMETHODIMP_(nsrefcnt)
nsHTMLLabelElement::Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLLabelElement");
if (mRefCnt <= 0) {
delete this;
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLLabelElement");
delete this;
return 0;
} else {

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

@ -320,6 +320,7 @@ nsHTMLSelectElement::Release()
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLSelectElement");
delete this;
return 0;
} else {

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

@ -207,11 +207,13 @@ NS_IMETHODIMP_(nsrefcnt)
nsHTMLTextAreaElement::Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLTextAreaElement");
if (mRefCnt <= 0) {
delete this;
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLTextAreaElement");
delete this;
return 0;
} else {

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

@ -183,6 +183,7 @@ nsHTMLButtonElement::Release()
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLButtonElement");
delete this;
return 0;
} else {
@ -525,11 +526,11 @@ nsHTMLButtonElement::SetForm(nsIDOMHTMLFormElement* aForm)
if (mForm && formControl)
mForm->RemoveElement(formControl, PR_TRUE);
NS_IF_RELEASE(mForm);
if (nsnull == aForm)
mForm = nsnull;
else {
NS_IF_RELEASE(mForm);
if (formControl) {
result = aForm->QueryInterface(kIFormIID, (void**)&mForm); // keep the ref
if ((NS_OK == result) && mForm) {

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

@ -124,11 +124,13 @@ NS_IMETHODIMP_(nsrefcnt)
nsHTMLFieldSetElement::Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFieldSetElement");
if (mRefCnt <= 0) {
delete this;
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFieldSetElement");
delete this;
return 0;
} else {

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

@ -253,7 +253,14 @@ nsHTMLFormElement::Release()
PRUint32 numChildren;
GetElementCount(&numChildren);
if (mRefCnt == nsrefcnt(numChildren)) {
#ifdef NS_BUILD_REFCNT_LOGGING
while(mRefCnt > 0) {
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFormElement");
}
#else
mRefCnt = 0;
#endif
delete this;
return 0;
}

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

@ -306,6 +306,7 @@ nsHTMLInputElement::Release()
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLInputElement");
delete this;
return 0;
} else {

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

@ -134,11 +134,13 @@ NS_IMETHODIMP_(nsrefcnt)
nsHTMLLabelElement::Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLLabelElement");
if (mRefCnt <= 0) {
delete this;
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLLabelElement");
delete this;
return 0;
} else {

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

@ -320,6 +320,7 @@ nsHTMLSelectElement::Release()
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLSelectElement");
delete this;
return 0;
} else {

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

@ -207,11 +207,13 @@ NS_IMETHODIMP_(nsrefcnt)
nsHTMLTextAreaElement::Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLTextAreaElement");
if (mRefCnt <= 0) {
delete this;
return 0;
} else if ((1 == mRefCnt) && mForm) {
mRefCnt = 0;
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLTextAreaElement");
delete this;
return 0;
} else {