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

This commit is contained in:
bnesse%netscape.com 2001-10-30 22:57:44 +00:00
Родитель 9c25ea824a
Коммит 5979dfe6c4
1 изменённых файлов: 1 добавлений и 4 удалений

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

@ -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);
}