Bug 1184397 - Release the observer service when the permission manager shuts down; r=jdm

This commit is contained in:
Ehsan Akhgari 2015-07-15 20:37:06 -04:00
parent 5d2efab883
commit 923c6b9d49

View File

@ -436,6 +436,7 @@ nsPermissionManager::Init()
if (NS_SUCCEEDED(rv)) {
mObserverService->AddObserver(this, "profile-before-change", true);
mObserverService->AddObserver(this, "profile-do-change", true);
mObserverService->AddObserver(this, "xpcom-shutdown", true);
}
if (IsChildProcess()) {
@ -1494,10 +1495,11 @@ NS_IMETHODIMP nsPermissionManager::Observe(nsISupports *aSubject, const char *aT
mIsShuttingDown = true;
RemoveAllFromMemory();
CloseDB(false);
}
else if (!nsCRT::strcmp(aTopic, "profile-do-change")) {
} else if (!nsCRT::strcmp(aTopic, "profile-do-change")) {
// the profile has already changed; init the db from the new location
InitDB(false);
} else if (!nsCRT::strcmp(aTopic, "xpcom-shutdown")) {
mObserverService = nullptr;
}
return NS_OK;