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(); }; /*