From dc38a4a602c45b681c8d3c6396f213f79d4f3f66 Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Fri, 17 Dec 1999 00:50:17 +0000 Subject: [PATCH] fix antother webshell leak. Add a CleanUp method to the global window. When the global window is told it is closing, call the CleanUp method to force it to release all of it's state. r=vidur, a=chofmann git-svn-id: svn://10.0.0.236/trunk@56124 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/dom/src/base/nsGlobalWindow.cpp | 11 +++++++++-- mozilla/dom/src/base/nsGlobalWindow.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index 338d44c5fe3..3c21751d6a2 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -181,8 +181,8 @@ GlobalWindowImpl::GlobalWindowImpl() mWebShell = nsnull; } -GlobalWindowImpl::~GlobalWindowImpl() -{ +void GlobalWindowImpl::CleanUp() +{ NS_IF_RELEASE(mContext); NS_IF_RELEASE(mDocument); NS_IF_RELEASE(mNavigator); @@ -200,6 +200,11 @@ GlobalWindowImpl::~GlobalWindowImpl() NS_IF_RELEASE(mListenerManager); } +GlobalWindowImpl::~GlobalWindowImpl() +{ + CleanUp(); +} + NS_IMPL_ADDREF(GlobalWindowImpl) NS_IMPL_RELEASE(GlobalWindowImpl) @@ -1348,6 +1353,8 @@ GlobalWindowImpl::Close() mBrowser->Close(); NS_RELEASE(mBrowser); } + + CleanUp(); return NS_OK; } diff --git a/mozilla/dom/src/base/nsGlobalWindow.h b/mozilla/dom/src/base/nsGlobalWindow.h index 07da4873a32..5bd5733c0a1 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.h +++ b/mozilla/dom/src/base/nsGlobalWindow.h @@ -297,6 +297,8 @@ protected: nsDOMWindowList *mFrames; PRBool mFirstDocumentLoad; + + void CleanUp(); }; /*