From ddbeb7d31250e998a38167eeaa5a69242a8d0c94 Mon Sep 17 00:00:00 2001 From: "davidm%netscape.com" Date: Fri, 16 Apr 1999 00:23:44 +0000 Subject: [PATCH] Fix problem where windows would quit after closing the window --- xpfe/appshell/src/nsNetSupportDialog.cpp | 18 +++++++++--------- xpfe/appshell/src/nsNetSupportDialog.h | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/xpfe/appshell/src/nsNetSupportDialog.cpp b/xpfe/appshell/src/nsNetSupportDialog.cpp index 3de943e79f4d..8f4e731adb77 100644 --- a/xpfe/appshell/src/nsNetSupportDialog.cpp +++ b/xpfe/appshell/src/nsNetSupportDialog.cpp @@ -34,6 +34,7 @@ #include "nsIWebShellWindow.H" #include "nsIDOMEventReceiver.h" #include "nsIURL.h" + /* Define Class IDs */ static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); @@ -193,6 +194,14 @@ nsNetSupportDialog::nsNetSupportDialog() Init(); } +nsNetSupportDialog::~nsNetSupportDialog() +{ + NS_IF_RELEASE( mWebShell ); + NS_IF_RELEASE( mWebShellWindow ); + NS_IF_RELEASE( mOKButton ); + NS_IF_RELEASE( mCancelButton ); +} + void nsNetSupportDialog::Init() { @@ -302,12 +311,6 @@ nsresult nsNetSupportDialog::DoDialog( nsString& inXULURL ) return result; } - if ( !NS_SUCCEEDED (result = appShellService->Initialize() ) ) - { - appShellService->Release(); - return result; - } - nsIURL* dialogURL; if (!NS_SUCCEEDED (result = NS_NewURL(&dialogURL, inXULURL ) ) ) { @@ -343,7 +346,6 @@ void nsNetSupportDialog::OnOK() // Fill in NetLib struct *mReturnValue = kOKButton; // Cleanup - mWebShell->Release(); mWebShellWindow->Close(); } @@ -351,7 +353,6 @@ void nsNetSupportDialog::OnOK() void nsNetSupportDialog::OnCancel() { *mReturnValue = kCancelButton; - mWebShell->Release(); mWebShellWindow->Close(); } @@ -427,7 +428,6 @@ NS_IMETHODIMP nsNetSupportDialog::QueryInterface(REFNSIID aIID,void** aInstanceP return NS_OK; } - return NS_NOINTERFACE; } diff --git a/xpfe/appshell/src/nsNetSupportDialog.h b/xpfe/appshell/src/nsNetSupportDialog.h index a53467378514..cb4c8e7f3f27 100644 --- a/xpfe/appshell/src/nsNetSupportDialog.h +++ b/xpfe/appshell/src/nsNetSupportDialog.h @@ -30,6 +30,7 @@ class nsNetSupportDialog : public nsINetSupportDialogService, public nsIXULWind { public: nsNetSupportDialog(); + ~nsNetSupportDialog(); NS_IMETHOD Alert( const nsString &aText ); NS_IMETHOD Confirm( const nsString &aText,PRInt32* returnValue );