Fix leak when loading standalone images. Bug 179498, patch by keeda@hotpop.com

(Harshal), r=jst, sr=bzbarsky
This commit is contained in:
bzbarsky%mit.edu 2002-12-13 23:53:43 +00:00
parent c28c31544d
commit 159f8a2812

View File

@ -97,6 +97,8 @@ public:
PRBool aReset = PR_TRUE,
nsIContentSink* aSink = nsnull);
NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
nsresult CreateSyntheticDocument();
nsresult EndLayout(nsISupports *ctxt,
@ -274,6 +276,18 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
return NS_OK;
}
NS_IMETHODIMP
nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
{
if (!aScriptGlobalObject) {
// If the global object is being set to null, then it means we are
// going away soon. Drop our ref to imgRequest so that we don't end
// up leaking due to cycles through imgLib
mImageRequest = nsnull;
}
return nsHTMLDocument::SetScriptGlobalObject(aScriptGlobalObject);
}
nsresult
nsImageDocument::CreateSyntheticDocument()