From 923c6b9d49a527da6698d2e1acfc7fd92faa3bd3 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 15 Jul 2015 20:37:06 -0400 Subject: [PATCH] Bug 1184397 - Release the observer service when the permission manager shuts down; r=jdm --- extensions/cookie/nsPermissionManager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index 31485ca82e6..0706c80b5cc 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -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;