зеркало из 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;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLButtonElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -525,11 +526,11 @@ nsHTMLButtonElement::SetForm(nsIDOMHTMLFormElement* aForm)
|
||||||
|
|
||||||
if (mForm && formControl)
|
if (mForm && formControl)
|
||||||
mForm->RemoveElement(formControl, PR_TRUE);
|
mForm->RemoveElement(formControl, PR_TRUE);
|
||||||
NS_IF_RELEASE(mForm);
|
|
||||||
|
|
||||||
if (nsnull == aForm)
|
if (nsnull == aForm)
|
||||||
mForm = nsnull;
|
mForm = nsnull;
|
||||||
else {
|
else {
|
||||||
|
NS_IF_RELEASE(mForm);
|
||||||
if (formControl) {
|
if (formControl) {
|
||||||
result = aForm->QueryInterface(kIFormIID, (void**)&mForm); // keep the ref
|
result = aForm->QueryInterface(kIFormIID, (void**)&mForm); // keep the ref
|
||||||
if ((NS_OK == result) && mForm) {
|
if ((NS_OK == result) && mForm) {
|
||||||
|
|
|
@ -124,11 +124,13 @@ NS_IMETHODIMP_(nsrefcnt)
|
||||||
nsHTMLFieldSetElement::Release()
|
nsHTMLFieldSetElement::Release()
|
||||||
{
|
{
|
||||||
--mRefCnt;
|
--mRefCnt;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFieldSetElement");
|
||||||
if (mRefCnt <= 0) {
|
if (mRefCnt <= 0) {
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFieldSetElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -253,7 +253,14 @@ nsHTMLFormElement::Release()
|
||||||
PRUint32 numChildren;
|
PRUint32 numChildren;
|
||||||
GetElementCount(&numChildren);
|
GetElementCount(&numChildren);
|
||||||
if (mRefCnt == nsrefcnt(numChildren)) {
|
if (mRefCnt == nsrefcnt(numChildren)) {
|
||||||
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||||
|
while(mRefCnt > 0) {
|
||||||
|
--mRefCnt;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFormElement");
|
||||||
|
}
|
||||||
|
#else
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
#endif
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,6 +306,7 @@ nsHTMLInputElement::Release()
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLInputElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -134,11 +134,13 @@ NS_IMETHODIMP_(nsrefcnt)
|
||||||
nsHTMLLabelElement::Release()
|
nsHTMLLabelElement::Release()
|
||||||
{
|
{
|
||||||
--mRefCnt;
|
--mRefCnt;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLLabelElement");
|
||||||
if (mRefCnt <= 0) {
|
if (mRefCnt <= 0) {
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLLabelElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -320,6 +320,7 @@ nsHTMLSelectElement::Release()
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLSelectElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -207,11 +207,13 @@ NS_IMETHODIMP_(nsrefcnt)
|
||||||
nsHTMLTextAreaElement::Release()
|
nsHTMLTextAreaElement::Release()
|
||||||
{
|
{
|
||||||
--mRefCnt;
|
--mRefCnt;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLTextAreaElement");
|
||||||
if (mRefCnt <= 0) {
|
if (mRefCnt <= 0) {
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLTextAreaElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -183,6 +183,7 @@ nsHTMLButtonElement::Release()
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLButtonElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -525,11 +526,11 @@ nsHTMLButtonElement::SetForm(nsIDOMHTMLFormElement* aForm)
|
||||||
|
|
||||||
if (mForm && formControl)
|
if (mForm && formControl)
|
||||||
mForm->RemoveElement(formControl, PR_TRUE);
|
mForm->RemoveElement(formControl, PR_TRUE);
|
||||||
NS_IF_RELEASE(mForm);
|
|
||||||
|
|
||||||
if (nsnull == aForm)
|
if (nsnull == aForm)
|
||||||
mForm = nsnull;
|
mForm = nsnull;
|
||||||
else {
|
else {
|
||||||
|
NS_IF_RELEASE(mForm);
|
||||||
if (formControl) {
|
if (formControl) {
|
||||||
result = aForm->QueryInterface(kIFormIID, (void**)&mForm); // keep the ref
|
result = aForm->QueryInterface(kIFormIID, (void**)&mForm); // keep the ref
|
||||||
if ((NS_OK == result) && mForm) {
|
if ((NS_OK == result) && mForm) {
|
||||||
|
|
|
@ -124,11 +124,13 @@ NS_IMETHODIMP_(nsrefcnt)
|
||||||
nsHTMLFieldSetElement::Release()
|
nsHTMLFieldSetElement::Release()
|
||||||
{
|
{
|
||||||
--mRefCnt;
|
--mRefCnt;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFieldSetElement");
|
||||||
if (mRefCnt <= 0) {
|
if (mRefCnt <= 0) {
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFieldSetElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -253,7 +253,14 @@ nsHTMLFormElement::Release()
|
||||||
PRUint32 numChildren;
|
PRUint32 numChildren;
|
||||||
GetElementCount(&numChildren);
|
GetElementCount(&numChildren);
|
||||||
if (mRefCnt == nsrefcnt(numChildren)) {
|
if (mRefCnt == nsrefcnt(numChildren)) {
|
||||||
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||||
|
while(mRefCnt > 0) {
|
||||||
|
--mRefCnt;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFormElement");
|
||||||
|
}
|
||||||
|
#else
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
#endif
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,6 +306,7 @@ nsHTMLInputElement::Release()
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLInputElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -134,11 +134,13 @@ NS_IMETHODIMP_(nsrefcnt)
|
||||||
nsHTMLLabelElement::Release()
|
nsHTMLLabelElement::Release()
|
||||||
{
|
{
|
||||||
--mRefCnt;
|
--mRefCnt;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLLabelElement");
|
||||||
if (mRefCnt <= 0) {
|
if (mRefCnt <= 0) {
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLLabelElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -320,6 +320,7 @@ nsHTMLSelectElement::Release()
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLSelectElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -207,11 +207,13 @@ NS_IMETHODIMP_(nsrefcnt)
|
||||||
nsHTMLTextAreaElement::Release()
|
nsHTMLTextAreaElement::Release()
|
||||||
{
|
{
|
||||||
--mRefCnt;
|
--mRefCnt;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLTextAreaElement");
|
||||||
if (mRefCnt <= 0) {
|
if (mRefCnt <= 0) {
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else if ((1 == mRefCnt) && mForm) {
|
} else if ((1 == mRefCnt) && mForm) {
|
||||||
mRefCnt = 0;
|
mRefCnt = 0;
|
||||||
|
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLTextAreaElement");
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче