UnloadAccounts.

This commit is contained in:
putterman%netscape.com 1999-06-29 02:49:15 +00:00
parent 5fd99cd3de
commit eed8630e77
2 changed files with 17 additions and 6 deletions

View File

@ -118,6 +118,7 @@ public:
NS_IMETHOD GetAllServers(nsISupportsArray **_retval) ;
NS_IMETHOD LoadAccounts();
NS_IMETHOD UnloadAccounts();
NS_IMETHOD FindServer(const char* username,
const char* hostname,
@ -191,12 +192,9 @@ nsMsgAccountManager::nsMsgAccountManager() :
nsMsgAccountManager::~nsMsgAccountManager()
{
// release the default account
m_defaultAccount=nsnull;
if (m_prefs) nsServiceManager::ReleaseService(kPrefServiceCID, m_prefs);
m_accounts->Enumerate(hashTableRemoveAccountFromBiff, this);
m_accounts->Enumerate(hashTableRemoveAccount, this);
UnloadAccounts();
delete m_accounts;
}
@ -503,11 +501,9 @@ nsMsgAccountManager::hashTableRemoveAccount(nsHashKey *aKey, void *aData,
void*closure)
{
nsIMsgAccount* account = (nsIMsgAccount*)aData;
nsMsgAccountManager* accountManager = (nsMsgAccountManager*) closure;
// remove from hashtable
NS_RELEASE(account);
accountManager->m_accounts->Remove(aKey);
return PR_TRUE;
}
@ -690,6 +686,18 @@ nsMsgAccountManager::LoadAccounts()
return NS_OK;
}
nsresult
nsMsgAccountManager::UnloadAccounts()
{
// release the default account
m_defaultAccount=nsnull;
m_accounts->Enumerate(hashTableRemoveAccountFromBiff, this);
m_accounts->Enumerate(hashTableRemoveAccount, this);
m_accounts->Reset();
m_accountsLoaded = PR_FALSE;
return NS_OK;
}
nsIMsgAccount *
nsMsgAccountManager::LoadAccount(nsString& accountKey)
{

View File

@ -54,6 +54,9 @@ nsMsgMailSession::nsMsgMailSession():
nsMsgMailSession::~nsMsgMailSession()
{
if(m_accountManager)
m_accountManager->UnloadAccounts();
NS_IF_RELEASE(m_accountManager);
if (mListeners)