Added NS_ShutdownXPCOM to facilitate leak detection in purify.

This commit is contained in:
warren%netscape.com 1999-07-28 08:03:49 +00:00
Родитель b2e94aeec5
Коммит 40021f91f4
2 изменённых файлов: 15 добавлений и 13 удалений

Просмотреть файл

@ -122,10 +122,6 @@ nsViewerApp::nsViewerApp()
nsViewerApp::~nsViewerApp()
{
Destroy();
if (nsnull != mPrefs) {
mPrefs->ShutDown();
NS_RELEASE(mPrefs);
}
}
NS_IMPL_THREADSAFE_ADDREF(nsViewerApp)
@ -166,12 +162,16 @@ nsViewerApp::Destroy()
// Release the crawler
NS_IF_RELEASE(mCrawler);
#ifndef NECKO
// Only shutdown if Initialize has been called...
if (PR_TRUE == mIsInitialized) {
#ifndef NECKO
NS_ShutdownINetService();
mIsInitialized = PR_FALSE;
}
#endif // NECKO
if (nsnull != mPrefs) {
mPrefs->ShutDown();
NS_RELEASE(mPrefs);
}
}

Просмотреть файл

@ -22,6 +22,7 @@
#include "nsITimer.h"
#include "JSConsole.h"
#include "plevent.h"
#include "nsIServiceManager.h"
JSConsole *gConsole;
HINSTANCE gInstance, gPrevInstance;
@ -96,13 +97,18 @@ nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID)
int main(int argc, char **argv)
{
nsresult rv;
nsIServiceManager* servMgr;
rv = NS_InitXPCOM(&servMgr);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
nsViewerApp* app = new nsNativeViewerApp();
NS_ADDREF(app);
app->Initialize(argc, argv);
app->Run();
int result = app->Run();
NS_RELEASE(app);
return 0;
rv = NS_ShutdownXPCOM(servMgr);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
return result;
}
int PASCAL
@ -111,9 +117,5 @@ WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
{
gInstance = instance;
gPrevInstance = prevInstance;
nsViewerApp* app = new nsNativeViewerApp();
app->Initialize(0, nsnull);
int result = app->Run();
delete app;
return result;
return main(0, nsnull);
}