From 61eba8993a7728d340259ff8085e99ca98dac79e Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Thu, 18 Mar 1999 19:08:36 +0000 Subject: [PATCH] Added and used Close() method to nsWebShellWindow. Part of fix for bug 3676 (again) and 3900. Wants to be part of M3 build. r:sdagley,pierre. a:chofmann,cyeh. git-svn-id: svn://10.0.0.236/trunk@24305 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpfe/appshell/src/nsAppShellService.cpp | 18 +++++++++++++----- .../xpfe/appshell/src/nsWebShellWindow.cpp | 19 ++++++++++++++++++- mozilla/xpfe/appshell/src/nsWebShellWindow.h | 1 + 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/mozilla/xpfe/appshell/src/nsAppShellService.cpp b/mozilla/xpfe/appshell/src/nsAppShellService.cpp index 113640fe817..6a9ddd49314 100644 --- a/mozilla/xpfe/appshell/src/nsAppShellService.cpp +++ b/mozilla/xpfe/appshell/src/nsAppShellService.cpp @@ -247,14 +247,22 @@ nsAppShellService::CreateTopLevelWindow(nsIWidget *aParent, NS_IMETHODIMP nsAppShellService::CloseTopLevelWindow(nsIWidget* aWindow) { - nsresult rv; + nsresult closerv, unregrv; + void *data; - rv = UnregisterTopLevelWindow(aWindow); - if (0 == mWindowList->Count()) { - mAppShell->Exit(); + aWindow->GetClientData(data); + if (data == nsnull) + closerv = NS_ERROR_NULL_POINTER; + else { + nsWebShellWindow* window = (nsWebShellWindow *) data; + window->Close(); } - return rv; + unregrv = UnregisterTopLevelWindow(aWindow); + if (0 == mWindowList->Count()) + mAppShell->Exit(); + + return closerv == NS_OK ? unregrv : closerv; } /* diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 3059e8c9634..95af6899fc3 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -275,6 +275,24 @@ nsresult nsWebShellWindow::Initialize(nsIWidget* aParent, } +/* + * Close the window + */ +NS_METHOD +nsWebShellWindow::Close() +{ + NS_IF_RELEASE(mWindow); + NS_IF_RELEASE(mWebShell); + /* note: this next Release() seems like the right thing to do, but it doesn't + appear exactly necessary, and we are afraid of possible repercussions + unexplored at this time. ("this time" being a stability release crunch.) + Revisit this later!? + */ +// Release(); + return NS_OK; +} + + /* * Event handler function... * @@ -321,7 +339,6 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) (nsISupports**)&appShell); if (NS_SUCCEEDED(rv)) { appShell->CloseTopLevelWindow(aEvent->widget); - nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); } break; diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.h b/mozilla/xpfe/appshell/src/nsWebShellWindow.h index 155a1e5766a..0cf3a666d31 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.h +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.h @@ -98,6 +98,7 @@ public: nsString& aControllerIID, nsIStreamObserver* anObserver, nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight); + NS_IMETHOD Close(); nsIWidget* GetWidget(void) { return mWindow; } // nsIDocumentLoaderObserver