Fix double-addref leak of stylesheets. b=49648 r=mjudge

This commit is contained in:
dbaron%fas.harvard.edu 2000-08-21 19:46:18 +00:00
parent 7f210bf5ea
commit 583abe126c
2 changed files with 4 additions and 4 deletions

View File

@ -271,7 +271,7 @@ nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
// XXX Not particularly efficient, but does anyone care?
for (i = 0; (i < imax) && (nsnull == *aReturn); i++) {
nsCOMPtr<nsIStyleSheet> sheet(do_QueryInterface(mDocument->GetStyleSheetAt(i)));
nsCOMPtr<nsIStyleSheet> sheet(dont_AddRef(mDocument->GetStyleSheetAt(i)));
if (!sheet)
continue;
nsCOMPtr<nsIDOMStyleSheet> domss(do_QueryInterface(sheet));
@ -279,7 +279,7 @@ nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
if (domss) {
if (count++ == aIndex) {
*aReturn = domss;
NS_IF_ADDREF(*aReturn = domss);
NS_IF_ADDREF(*aReturn);
}
}
}

View File

@ -271,7 +271,7 @@ nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
// XXX Not particularly efficient, but does anyone care?
for (i = 0; (i < imax) && (nsnull == *aReturn); i++) {
nsCOMPtr<nsIStyleSheet> sheet(do_QueryInterface(mDocument->GetStyleSheetAt(i)));
nsCOMPtr<nsIStyleSheet> sheet(dont_AddRef(mDocument->GetStyleSheetAt(i)));
if (!sheet)
continue;
nsCOMPtr<nsIDOMStyleSheet> domss(do_QueryInterface(sheet));
@ -279,7 +279,7 @@ nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
if (domss) {
if (count++ == aIndex) {
*aReturn = domss;
NS_IF_ADDREF(*aReturn = domss);
NS_IF_ADDREF(*aReturn);
}
}
}