Fix for bug 177585. Don't request the observer service when shutting down. r=dougt, sr=alecf.

git-svn-id: svn://10.0.0.236/trunk@106727 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bnesse%netscape.com
2001-10-30 22:57:44 +00:00
parent ac0c89244d
commit 1f6755259d

View File

@@ -119,6 +119,7 @@ nsPrefBranch::nsPrefBranch(const char *aPrefRoot, PRBool aDefaultBranch)
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
if (observerService) {
++mRefCnt; // Our refcnt must be > 0 when we call this, or we'll get deleted!
// add weak so we don't have to clean up at shutdown
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE);
--mRefCnt;
}
@@ -127,10 +128,6 @@ nsPrefBranch::nsPrefBranch(const char *aPrefRoot, PRBool aDefaultBranch)
nsPrefBranch::~nsPrefBranch()
{
freeObserverList();
nsCOMPtr<nsIObserverService> observerService =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
if (observerService)
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
}