Bug 723360 - crash nsMsgAccountManager::removeListenerFromFolder. r=dbienvenu
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Thu, 16 Feb 2012 11:04:51 +0900
changeset 10852 81e0d1fa912793098d87627dc8f7abd0bd8f1e37
parent 10851 a45f06ef7e2b8dce13b8ef14cba632db8357565f
child 10853 4f7b194ab8fa6cddd45852bb4ded26586dbed24c
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbienvenu
bugs723360
Bug 723360 - crash nsMsgAccountManager::removeListenerFromFolder. r=dbienvenu
mailnews/base/src/nsMsgAccountManager.cpp
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -871,22 +871,22 @@ PLDHashOperator
 nsMsgAccountManager::hashUnloadServer(nsCStringHashKey::KeyType aKey, nsCOMPtr<nsIMsgIncomingServer>& aServer, void* aClosure)
 {
   nsresult rv;
   nsMsgAccountManager *accountManager = (nsMsgAccountManager*) aClosure;
   accountManager->NotifyServerUnloaded(aServer);
 
   nsCOMPtr<nsIMsgFolder> rootFolder;
   rv = aServer->GetRootFolder(getter_AddRefs(rootFolder));
-
-  accountManager->mFolderListeners->EnumerateForwards(removeListenerFromFolder,
+  if (NS_SUCCEEDED(rv)) {
+    accountManager->mFolderListeners->EnumerateForwards(removeListenerFromFolder,
                                       (void *)(nsIMsgFolder*)rootFolder);
 
-  if(NS_SUCCEEDED(rv))
     rootFolder->Shutdown(true);
+  }
 
   return PL_DHASH_NEXT;
 }
 
 void nsMsgAccountManager::LogoutOfServer(nsIMsgIncomingServer *aServer)
 {
   nsresult rv = aServer->Shutdown();
   NS_ASSERTION(NS_SUCCEEDED(rv), "Shutdown of server failed");