Bug 875675 - Remove prefs mail.account.accountX.identities and mail.account.accountX.server when an account is deleted. r=Neil
authoraceman <acelists@atlas.sk>
Thu, 13 Jun 2013 09:33:16 -0400
changeset 15728 b1fd2d8e66d2613675228141e71d2e4fbc89bc84
parent 15727 a458adca8045cd7ac3c9d3aae9cdf6ff4a2196e9
child 15729 6c5f4cc58b286b16310c9977e43203c29903ffcd
push idunknown
push userunknown
push dateunknown
reviewersNeil
bugs875675
Bug 875675 - Remove prefs mail.account.accountX.identities and mail.account.accountX.server when an account is deleted. r=Neil
mailnews/base/src/nsMsgAccount.cpp
mailnews/base/src/nsMsgAccountManager.cpp
--- a/mailnews/base/src/nsMsgAccount.cpp
+++ b/mailnews/base/src/nsMsgAccount.cpp
@@ -427,10 +427,10 @@ nsMsgAccount::ToString(nsAString& aResul
 }
 
 NS_IMETHODIMP
 nsMsgAccount::ClearAllValues()
 {
   nsresult rv = getPrefService();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return m_prefs->DeleteBranch(nullptr);
+  return m_prefs->DeleteBranch("");
 }
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -707,17 +707,21 @@ nsMsgAccountManager::RemoveAccount(nsIMs
         }
       }
       // clear out all identity information if no other account uses it.
       if (!identityStillUsed)
         identity->ClearAllValues();
     }
   }
 
-  aAccount->ClearAllValues();
+  // It is not a critical problem if this fails as the account was already
+  // removed from the list of accounts so should not ever be referenced.
+  // Just print it out for debugging.
+  rv = aAccount->ClearAllValues();
+  NS_ASSERTION(NS_SUCCEEDED(rv), "removing of account prefs failed");
   return NS_OK;
 }
 
 nsresult
 nsMsgAccountManager::OutputAccountsPref()
 {
   nsCString accountKey;
   mAccountKeyList.Truncate();