mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Fix double-addref leak of stylesheets. b=49648 r=mjudge
This commit is contained in:
parent
7f210bf5ea
commit
583abe126c
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user