From 8a33dd4047c27daecd186ed99d2ef11b3ccf07ae Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Mon, 10 Sep 2001 23:27:08 +0000 Subject: [PATCH] clean up use of nsAppShellService.UnregisterTopLevelWindow. bug 98792 r=alecf,ccarlen git-svn-id: svn://10.0.0.236/trunk@102698 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpfe/bootstrap/nsNativeAppSupportOS2.cpp | 12 ++++++++++-- mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportOS2.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportOS2.cpp index 7e47f6a3f53..2789e938240 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportOS2.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportOS2.cpp @@ -1568,8 +1568,16 @@ nsNativeAppSupportOS2::HandleRequest( LPBYTE request, PRBool newWindow ) { rv = appShell->GetNativeAppSupport( getter_AddRefs( native )); if (NS_SUCCEEDED(rv)) { native->SetIsServerMode( PR_FALSE ); - // This closes app if there are no top-level windows. - appShell->UnregisterTopLevelWindow( 0 ); + + // close app if there are no more top-level windows. + PRBool quitIfNoWindows = PR_FALSE; + appShell->GetQuitOnLastWindowClosing( &quitIfNoWindows ); + if (quitIfNoWindows) { + nsCOMPtr win; + GetMostRecentWindow( 0, getter_AddRefs( win ) ); + if (!win) + appShell->Quit(); + } } return; diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp index e3ec4a665fa..f8f7ae08e45 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -1260,8 +1260,16 @@ nsNativeAppSupportWin::HandleRequest( LPBYTE request, PRBool newWindow ) { rv = appShell->GetNativeAppSupport( getter_AddRefs( native )); if (NS_SUCCEEDED(rv)) { native->SetIsServerMode( PR_FALSE ); - // This closes app if there are no top-level windows. - appShell->UnregisterTopLevelWindow( 0 ); + + // close app if there are no more top-level windows. + PRBool quitIfNoWindows = PR_FALSE; + appShell->GetQuitOnLastWindowClosing( &quitIfNoWindows ); + if (quitIfNoWindows) { + nsCOMPtr win; + GetMostRecentWindow( 0, getter_AddRefs( win ) ); + if (!win) + appShell->Quit(); + } } return;