From b84faceff55530c1a6e2391900c0e4e7abfea12c Mon Sep 17 00:00:00 2001 From: "pollmann%netscape.com" Date: Fri, 12 May 2000 00:53:38 +0000 Subject: [PATCH] Bug 35573: Fix part of a webshell leak, r=nisheeth git-svn-id: svn://10.0.0.236/trunk@69300 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLDocument.cpp | 20 +++++++++---------- .../html/document/src/nsHTMLDocument.cpp | 20 +++++++++---------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 09b7923a23b..f756919b376 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -1807,31 +1807,29 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) mIsWriting = 1; if (NS_OK == result) { - nsIHTMLContentSink* sink; - nsIWebShell* webShell = nsnull; + nsCOMPtr sink; + nsCOMPtr webShell; // Get the webshell of our primary presentation shell nsIPresShell* shell = (nsIPresShell*) mPresShells.ElementAt(0); - if (nsnull != shell) { + if (shell) { nsCOMPtr cx; shell->GetPresContext(getter_AddRefs(cx)); - nsISupports* container; - if (NS_OK == cx->GetContainer(&container)) { - if (nsnull != container) { - container->QueryInterface(kIWebShellIID, (void**) &webShell); + nsCOMPtr container; + if (NS_OK == cx->GetContainer(getter_AddRefs(container))) { + if (container) { + webShell = do_QueryInterface(container); } } } - result = NS_NewHTMLContentSink(&sink, this, aSourceURL, webShell); - NS_IF_RELEASE(webShell); - + result = NS_NewHTMLContentSink(getter_AddRefs(sink), this, aSourceURL, webShell); + if (NS_OK == result) { nsIDTD* theDTD=0; NS_NewNavHTMLDTD(&theDTD); mParser->RegisterDTD(theDTD); mParser->SetContentSink(sink); - NS_RELEASE(sink); } } } diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp index 09b7923a23b..f756919b376 100644 --- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp @@ -1807,31 +1807,29 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURL) mIsWriting = 1; if (NS_OK == result) { - nsIHTMLContentSink* sink; - nsIWebShell* webShell = nsnull; + nsCOMPtr sink; + nsCOMPtr webShell; // Get the webshell of our primary presentation shell nsIPresShell* shell = (nsIPresShell*) mPresShells.ElementAt(0); - if (nsnull != shell) { + if (shell) { nsCOMPtr cx; shell->GetPresContext(getter_AddRefs(cx)); - nsISupports* container; - if (NS_OK == cx->GetContainer(&container)) { - if (nsnull != container) { - container->QueryInterface(kIWebShellIID, (void**) &webShell); + nsCOMPtr container; + if (NS_OK == cx->GetContainer(getter_AddRefs(container))) { + if (container) { + webShell = do_QueryInterface(container); } } } - result = NS_NewHTMLContentSink(&sink, this, aSourceURL, webShell); - NS_IF_RELEASE(webShell); - + result = NS_NewHTMLContentSink(getter_AddRefs(sink), this, aSourceURL, webShell); + if (NS_OK == result) { nsIDTD* theDTD=0; NS_NewNavHTMLDTD(&theDTD); mParser->RegisterDTD(theDTD); mParser->SetContentSink(sink); - NS_RELEASE(sink); } } }