From 75f3adcd31f851f9ae54ef3ad8cb7f59b4628e25 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Fri, 1 Feb 2002 20:12:35 +0000 Subject: [PATCH] fix ref count bloat Bug 123011 sr=hyatt git-svn-id: svn://10.0.0.236/trunk@113435 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 6 +----- mozilla/dom/src/base/nsGlobalWindow.cpp | 15 +++------------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index a6d066e93bd..dc3fd88ada4 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -277,14 +277,10 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink) if (aIID.Equals(NS_GET_IID(nsIURIContentListener)) && NS_SUCCEEDED(EnsureContentListener())) { *aSink = mContentListener; - NS_IF_ADDREF(mContentListener); } else if (aIID.Equals(NS_GET_IID(nsIScriptGlobalObject)) && NS_SUCCEEDED(EnsureScriptEnvironment())) { - nsIScriptGlobalObject* scrGlobObj = (nsIScriptGlobalObject*)mScriptGlobal.get(); - NS_ASSERTION(scrGlobObj, "This MUST support this interface!"); - NS_ADDREF(scrGlobObj); - *aSink = scrGlobObj; + *aSink = mScriptGlobal; } else if (aIID.Equals(NS_GET_IID(nsIDOMWindowInternal)) && NS_SUCCEEDED(EnsureScriptEnvironment())) { diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index 51f9233d4fa..e5ceba8f411 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -3378,18 +3378,12 @@ NS_IMETHODIMP GlobalWindowImpl::GetInterface(const nsIID & aIID, void **aSink) if (aIID.Equals(NS_GET_IID(nsIDocCharset))) { if (mDocShell) { nsCOMPtr docCharset(do_QueryInterface(mDocShell)); - nsIDocCharset* docCS = (nsIDocCharset*)docCharset.get(); - NS_ASSERTION(docCS, "This MUST support this interface!"); - NS_ADDREF(docCS); - *aSink = docCS; + *aSink = docCharset; } } else if (aIID.Equals(NS_GET_IID(nsIWebNavigation))) { if (mDocShell) { - nsCOMPtr webNavigation(do_QueryInterface(mDocShell)); - nsIWebNavigation* webNav = (nsIWebNavigation*)webNavigation.get(); - NS_ASSERTION(webNav, "This MUST support this interface!"); - NS_ADDREF(webNav); + nsCOMPtr webNav(do_QueryInterface(mDocShell)); *aSink = webNav; } } @@ -3399,10 +3393,7 @@ NS_IMETHODIMP GlobalWindowImpl::GetInterface(const nsIID & aIID, void **aSink) mDocShell->GetContentViewer(getter_AddRefs(viewer)); if (viewer) { nsCOMPtr webBrowserPrint(do_QueryInterface(viewer)); - nsIWebBrowserPrint* print = (nsIWebBrowserPrint*)webBrowserPrint.get(); - NS_ASSERTION(print, "This MUST support this interface!"); - NS_ADDREF(print); - *aSink = print; + *aSink = webBrowserPrint; } } }