зеркало из https://github.com/mozilla/gecko-dev.git
Fix leak statistics by logging all releases, and fix one extra release. r=pollmann@netscape.com
This commit is contained in:
Родитель
914a800f54
Коммит
5b982b687a
|
@ -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 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче