зеркало из https://github.com/mozilla/pjs.git
breaking cycle between crawler and browser window to fix a leak, using NS_WITH_SERVICE to manage metacharset service.
This commit is contained in:
Родитель
ba6c2c928a
Коммит
ee3a2e5f9e
|
@ -157,12 +157,23 @@ nsViewerApp::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
|||
void
|
||||
nsViewerApp::Destroy()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Close all of our windows
|
||||
nsBrowserWindow::CloseAllWindows();
|
||||
|
||||
// Release the crawler
|
||||
NS_IF_RELEASE(mCrawler);
|
||||
if (nsnull != mCrawler) {
|
||||
// break cycle between crawler and window.
|
||||
mCrawler->SetBrowserWindow(nsnull);
|
||||
NS_RELEASE(mCrawler);
|
||||
}
|
||||
|
||||
NS_WITH_SERVICE(nsIMetaCharsetService, metacharset, kMetaCharsetCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = metacharset->End();
|
||||
}
|
||||
|
||||
#ifndef NECKO
|
||||
// Only shutdown if Initialize has been called...
|
||||
if (PR_TRUE == mIsInitialized) {
|
||||
|
@ -193,18 +204,11 @@ nsViewerApp::SetupRegistry()
|
|||
|
||||
NS_SetupRegistry();
|
||||
|
||||
nsIMetaCharsetService* metacharset;
|
||||
rv = nsServiceManager::GetService(kMetaCharsetCID,
|
||||
kIMetaCharsetServiceIID,
|
||||
(nsISupports **) &metacharset);
|
||||
if(!NS_FAILED(rv)) {
|
||||
NS_WITH_SERVICE(nsIMetaCharsetService, metacharset, kMetaCharsetCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = metacharset->Start();
|
||||
}
|
||||
|
||||
if(!NS_FAILED(rv)) {
|
||||
rv = nsServiceManager::ReleaseService(kMetaCharsetCID, metacharset);
|
||||
}
|
||||
|
||||
// Register our browser window factory
|
||||
nsIFactory* bwf;
|
||||
NS_NewBrowserWindowFactory(&bwf);
|
||||
|
|
Загрузка…
Ссылка в новой задаче