Fix for bug 241058. Debug only crash due to nsCOMPtr's internal checks when QI'ing. r+sr=bzbarsky@mit.edu

This commit is contained in:
jst%mozilla.jstenback.com 2004-05-12 01:57:54 +00:00
parent ea6ba72e90
commit f3889c559f
3 changed files with 3 additions and 10 deletions

View File

@ -145,14 +145,12 @@ nsHTMLSharedListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLSharedListElement* it = new nsHTMLSharedListElement();
nsRefPtr<nsHTMLSharedListElement> it = new nsHTMLSharedListElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMHTMLOListElement> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))

View File

@ -198,15 +198,12 @@ nsHTMLSharedElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLSharedElement* it = new nsHTMLSharedElement();
nsRefPtr<nsHTMLSharedElement> it = new nsHTMLSharedElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsISupports> kungFuDeathGrip =
NS_STATIC_CAST(nsIDOMHTMLEmbedElement *, it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))

View File

@ -143,14 +143,12 @@ nsHTMLObjectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLObjectElement* it = new nsHTMLObjectElement();
nsRefPtr<nsHTMLObjectElement> it = new nsHTMLObjectElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))