Fix problem where windows would quit after closing the window

This commit is contained in:
davidm%netscape.com 1999-04-16 00:23:44 +00:00
parent 0dc38deeda
commit ddbeb7d312
2 changed files with 10 additions and 9 deletions

View File

@ -34,6 +34,7 @@
#include "nsIWebShellWindow.H" #include "nsIWebShellWindow.H"
#include "nsIDOMEventReceiver.h" #include "nsIDOMEventReceiver.h"
#include "nsIURL.h" #include "nsIURL.h"
/* Define Class IDs */ /* Define Class IDs */
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
@ -193,6 +194,14 @@ nsNetSupportDialog::nsNetSupportDialog()
Init(); Init();
} }
nsNetSupportDialog::~nsNetSupportDialog()
{
NS_IF_RELEASE( mWebShell );
NS_IF_RELEASE( mWebShellWindow );
NS_IF_RELEASE( mOKButton );
NS_IF_RELEASE( mCancelButton );
}
void nsNetSupportDialog::Init() void nsNetSupportDialog::Init()
{ {
@ -302,12 +311,6 @@ nsresult nsNetSupportDialog::DoDialog( nsString& inXULURL )
return result; return result;
} }
if ( !NS_SUCCEEDED (result = appShellService->Initialize() ) )
{
appShellService->Release();
return result;
}
nsIURL* dialogURL; nsIURL* dialogURL;
if (!NS_SUCCEEDED (result = NS_NewURL(&dialogURL, inXULURL ) ) ) if (!NS_SUCCEEDED (result = NS_NewURL(&dialogURL, inXULURL ) ) )
{ {
@ -343,7 +346,6 @@ void nsNetSupportDialog::OnOK()
// Fill in NetLib struct // Fill in NetLib struct
*mReturnValue = kOKButton; *mReturnValue = kOKButton;
// Cleanup // Cleanup
mWebShell->Release();
mWebShellWindow->Close(); mWebShellWindow->Close();
} }
@ -351,7 +353,6 @@ void nsNetSupportDialog::OnOK()
void nsNetSupportDialog::OnCancel() void nsNetSupportDialog::OnCancel()
{ {
*mReturnValue = kCancelButton; *mReturnValue = kCancelButton;
mWebShell->Release();
mWebShellWindow->Close(); mWebShellWindow->Close();
} }
@ -427,7 +428,6 @@ NS_IMETHODIMP nsNetSupportDialog::QueryInterface(REFNSIID aIID,void** aInstanceP
return NS_OK; return NS_OK;
} }
return NS_NOINTERFACE; return NS_NOINTERFACE;
} }

View File

@ -30,6 +30,7 @@ class nsNetSupportDialog : public nsINetSupportDialogService, public nsIXULWind
{ {
public: public:
nsNetSupportDialog(); nsNetSupportDialog();
~nsNetSupportDialog();
NS_IMETHOD Alert( const nsString &aText ); NS_IMETHOD Alert( const nsString &aText );
NS_IMETHOD Confirm( const nsString &aText,PRInt32* returnValue ); NS_IMETHOD Confirm( const nsString &aText,PRInt32* returnValue );