Backing out alecf's checkin for bug 115152 as it's causing a crash on exit on optimized builds (and keeping tinderbox orange).

This commit is contained in:
bryner%netscape.com 2001-12-18 07:09:40 +00:00
Родитель ed7179fb30
Коммит a74f931cdb
3 изменённых файлов: 19 добавлений и 38 удалений

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

@ -395,8 +395,6 @@ NS_IMETHODIMP nsMetaCharsetObserver::Observe(nsISupports *aSubject,
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (!nsCRT::strcmp(aTopic, APPSTARTUP_CATEGORY)) if (!nsCRT::strcmp(aTopic, APPSTARTUP_CATEGORY))
rv = Start(); rv = Start();
else if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
rv = End();
return rv; return rv;
} }
@ -408,10 +406,6 @@ NS_IMETHODIMP nsMetaCharsetObserver::Start()
if (bMetaCharsetObserverStarted == PR_FALSE) { if (bMetaCharsetObserverStarted == PR_FALSE) {
bMetaCharsetObserverStarted = PR_TRUE; bMetaCharsetObserverStarted = PR_TRUE;
nsCOMPtr<nsIObserverService> obs = do_GetService("@mozilla.org/observer-service;1", &res);
if (NS_SUCCEEDED(res))
obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
nsCOMPtr<nsIParserService> parserService(do_GetService(kParserServiceCID)); nsCOMPtr<nsIParserService> parserService(do_GetService(kParserServiceCID));
if (!parserService) { if (!parserService) {

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

@ -74,7 +74,6 @@ static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID); static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID);
static NS_DEFINE_CID(kProtocolProxyServiceCID, NS_PROTOCOLPROXYSERVICE_CID); static NS_DEFINE_CID(kProtocolProxyServiceCID, NS_PROTOCOLPROXYSERVICE_CID);
static NS_DEFINE_CID(kStdURLParserCID, NS_STDURLPARSER_CID); static NS_DEFINE_CID(kStdURLParserCID, NS_STDURLPARSER_CID);
static NS_DEFINE_CID(kNoAuthParserCID, NS_NOAUTHURLPARSER_CID);
// A general port blacklist. Connections to these ports will not be avoided unless // A general port blacklist. Connections to these ports will not be avoided unless
// the protocol overrides. // the protocol overrides.
@ -231,7 +230,6 @@ nsIOService::Init()
do_GetService("@mozilla.org/observer-service;1"); do_GetService("@mozilla.org/observer-service;1");
NS_ASSERTION(observerService, "Failed to get observer service"); NS_ASSERTION(observerService, "Failed to get observer service");
if (observerService) { if (observerService) {
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE);
observerService->AddObserver(this, kProfileChangeNetTeardownTopic, PR_TRUE); observerService->AddObserver(this, kProfileChangeNetTeardownTopic, PR_TRUE);
observerService->AddObserver(this, kProfileChangeNetRestoreTopic, PR_TRUE); observerService->AddObserver(this, kProfileChangeNetRestoreTopic, PR_TRUE);
} }
@ -249,6 +247,7 @@ nsIOService::~nsIOService()
temp = NS_STATIC_CAST(nsISupports*, mURLParsers[i]); temp = NS_STATIC_CAST(nsISupports*, mURLParsers[i]);
NS_IF_RELEASE(temp); NS_IF_RELEASE(temp);
} }
(void)SetOffline(PR_TRUE);
if (mFileTransportService) if (mFileTransportService)
(void)mFileTransportService->Shutdown(); (void)mFileTransportService->Shutdown();
} }
@ -1041,9 +1040,5 @@ nsIOService::Observe(nsISupports *subject,
mOfflineForProfileChange = PR_FALSE; mOfflineForProfileChange = PR_FALSE;
} }
} }
else if (!nsCRT::strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
// go offline to shutdown certain services before actual destruction
SetOffline(PR_TRUE);
}
return NS_OK; return NS_OK;
} }

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

@ -199,8 +199,11 @@ private:
nsCOMPtr<nsIObserver> mCharsetMenuObserver; nsCOMPtr<nsIObserver> mCharsetMenuObserver;
nsCOMPtr<nsISupportsArray> mDecoderList; nsCOMPtr<nsISupportsArray> mDecoderList;
nsresult Done();
nsresult SetCharsetCheckmark(nsString * aCharset, PRBool aValue); nsresult SetCharsetCheckmark(nsString * aCharset, PRBool aValue);
nsresult FreeResources();
nsresult InitStaticMenu(nsISupportsArray * aDecs, nsresult InitStaticMenu(nsISupportsArray * aDecs,
nsIRDFResource * aResource, const char * aKey, nsVoidArray * aArray); nsIRDFResource * aResource, const char * aKey, nsVoidArray * aArray);
nsresult InitCacheMenu(nsISupportsArray * aDecs, nsIRDFResource * aResource, nsresult InitCacheMenu(nsISupportsArray * aDecs, nsIRDFResource * aResource,
@ -249,7 +252,7 @@ private:
nsresult RemoveFlaggedCharsets(nsISupportsArray * aList, nsString * aProp); nsresult RemoveFlaggedCharsets(nsISupportsArray * aList, nsString * aProp);
nsresult NewRDFContainer(nsIRDFDataSource * aDataSource, nsresult NewRDFContainer(nsIRDFDataSource * aDataSource,
nsIRDFResource * aResource, nsIRDFContainer ** aResult); nsIRDFResource * aResource, nsIRDFContainer ** aResult);
static void FreeMenuItemArray(nsVoidArray * aArray); void FreeMenuItemArray(nsVoidArray * aArray);
PRInt32 FindMenuItemInArray(nsVoidArray * aArray, nsIAtom * aCharset, PRInt32 FindMenuItemInArray(nsVoidArray * aArray, nsIAtom * aCharset,
nsMenuEntry ** aResult); nsMenuEntry ** aResult);
nsresult ReorderMenuItemArray(nsVoidArray * aArray); nsresult ReorderMenuItemArray(nsVoidArray * aArray);
@ -272,9 +275,6 @@ public:
nsresult RefreshMaileditMenu(); nsresult RefreshMaileditMenu();
nsresult RefreshComposerMenu(); nsresult RefreshComposerMenu();
nsresult Done();
nsresult FreeResources();
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Interface nsICurrentCharsetListener [declaration] // Interface nsICurrentCharsetListener [declaration]
@ -368,28 +368,28 @@ NS_IMETHODIMP nsCharsetMenuObserver::Observe(nsISupports *aSubject, const char *
if (nodeName.Equals(NS_LITERAL_STRING("browser"))) { if (nodeName.Equals(NS_LITERAL_STRING("browser"))) {
rv = mCharsetMenu->InitBrowserMenu(); rv = mCharsetMenu->InitBrowserMenu();
} }
else if (nodeName.Equals(NS_LITERAL_STRING("composer"))) { if (nodeName.Equals(NS_LITERAL_STRING("composer"))) {
rv = mCharsetMenu->InitComposerMenu(); rv = mCharsetMenu->InitComposerMenu();
} }
else if (nodeName.Equals(NS_LITERAL_STRING("mailview"))) { if (nodeName.Equals(NS_LITERAL_STRING("mailview"))) {
rv = mCharsetMenu->InitMailviewMenu(); rv = mCharsetMenu->InitMailviewMenu();
} }
else if (nodeName.Equals(NS_LITERAL_STRING("mailedit"))) { if (nodeName.Equals(NS_LITERAL_STRING("mailedit"))) {
rv = mCharsetMenu->InitMaileditMenu(); rv = mCharsetMenu->InitMaileditMenu();
rv = mCharsetMenu->InitOthers(); rv = mCharsetMenu->InitOthers();
} }
else if (nodeName.Equals(NS_LITERAL_STRING("more-menu"))) { if (nodeName.Equals(NS_LITERAL_STRING("more-menu"))) {
rv = mCharsetMenu->InitSecondaryTiers(); rv = mCharsetMenu->InitSecondaryTiers();
rv = mCharsetMenu->InitAutodetMenu(); rv = mCharsetMenu->InitAutodetMenu();
} }
else if (nodeName.Equals(NS_LITERAL_STRING("other"))) { if (nodeName.Equals(NS_LITERAL_STRING("other"))) {
rv = mCharsetMenu->InitOthers(); rv = mCharsetMenu->InitOthers();
rv = mCharsetMenu->InitMaileditMenu(); rv = mCharsetMenu->InitMaileditMenu();
} }
} }
//pref event handler //pref event handler
else if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
nsDependentString prefName(someData); nsDependentString prefName(someData);
if (prefName.Equals(NS_LITERAL_STRING(kBrowserStaticPrefKey))) { if (prefName.Equals(NS_LITERAL_STRING(kBrowserStaticPrefKey))) {
@ -403,13 +403,6 @@ NS_IMETHODIMP nsCharsetMenuObserver::Observe(nsISupports *aSubject, const char *
else if (prefName.Equals(NS_LITERAL_STRING(kMaileditPrefKey))) { else if (prefName.Equals(NS_LITERAL_STRING(kMaileditPrefKey))) {
rv = mCharsetMenu->RefreshMaileditMenu(); rv = mCharsetMenu->RefreshMaileditMenu();
} }
return rv;
}
else if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
mCharsetMenu->Done();
mCharsetMenu->FreeResources();
} }
NS_TIMELINE_STOP_TIMER("nsCharsetMenu:Observe"); NS_TIMELINE_STOP_TIMER("nsCharsetMenu:Observe");
@ -482,14 +475,10 @@ nsCharsetMenu::nsCharsetMenu()
nsCOMPtr<nsIObserverService> observerService = nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1", &res); do_GetService("@mozilla.org/observer-service;1", &res);
if (NS_SUCCEEDED(res)) { if (NS_SUCCEEDED(res))
res = observerService->AddObserver(mCharsetMenuObserver, res = observerService->AddObserver(mCharsetMenuObserver,
"charsetmenu-selected", "charsetmenu-selected",
PR_FALSE); PR_FALSE);
res = observerService->AddObserver(mCharsetMenuObserver,
NS_XPCOM_SHUTDOWN_OBSERVER_ID,
PR_FALSE);
}
} }
NS_ASSERTION(NS_SUCCEEDED(res), "Failed to initialize nsCharsetMenu"); NS_ASSERTION(NS_SUCCEEDED(res), "Failed to initialize nsCharsetMenu");
@ -499,6 +488,13 @@ nsCharsetMenu::nsCharsetMenu()
nsCharsetMenu::~nsCharsetMenu() nsCharsetMenu::~nsCharsetMenu()
{ {
Done();
FreeMenuItemArray(&mBrowserMenu);
FreeMenuItemArray(&mMailviewMenu);
FreeMenuItemArray(&mComposerMenu);
FreeResources();
} }
// XXX collapse these 2 in one // XXX collapse these 2 in one
@ -756,10 +752,6 @@ nsresult nsCharsetMenu::FreeResources()
{ {
nsresult res = NS_OK; nsresult res = NS_OK;
FreeMenuItemArray(&mBrowserMenu);
FreeMenuItemArray(&mMailviewMenu);
FreeMenuItemArray(&mComposerMenu);
if (mCharsetMenuObserver) { if (mCharsetMenuObserver) {
nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(mPrefs); nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(mPrefs);
if (pbi) { if (pbi) {