Bug 1776451 - prevent crash during account manager shutdown if folder cache isn't initialized. r=aleca

Differential Revision: https://phabricator.services.mozilla.com/D150298

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sean Burke 2022-06-24 23:22:40 +00:00
Родитель 2e2f69d522
Коммит d357c99f6a
1 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -191,10 +191,13 @@ nsresult nsMsgAccountManager::Shutdown() {
do_GetService(NS_MSGPURGESERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && purgeService) purgeService->Shutdown();
// The DTOR is meant to do the flushing, but observed behaviour is
// that it doesn't always get called. So flush explicitly.
m_msgFolderCache->Flush();
m_msgFolderCache = nullptr;
if (m_msgFolderCache) {
// The DTOR is meant to do the flushing, but observed behaviour is
// that it doesn't always get called. So flush explicitly.
m_msgFolderCache->Flush();
m_msgFolderCache = nullptr;
}
m_haveShutdown = true;
return NS_OK;
}