Bug 1800202 - Close db after use in nsMsgDBFolder::ReadDBFolderInfo(). r=benc

This is run from discoverFolders() at startup and can cause MSF loss if too many folders are left open.

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

--HG--
extra : rebase_source : ad78f749f8370878bfe75f22248974515a031132
This commit is contained in:
Betterbird 2022-11-21 13:01:37 +11:00
Родитель 9f89bfa4de
Коммит fcf8bcd7cb
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -642,6 +642,7 @@ nsresult nsMsgDBFolder::ReadDBFolderInfo(bool force) {
if (force || !mInitializedFromCache) {
nsCOMPtr<nsIDBFolderInfo> folderInfo;
nsCOMPtr<nsIMsgDatabase> db;
bool weOpenedDB = !mDatabase;
result =
GetDBFolderInfoAndDB(getter_AddRefs(folderInfo), getter_AddRefs(db));
if (NS_SUCCEEDED(result)) {
@ -676,6 +677,7 @@ nsresult nsMsgDBFolder::ReadDBFolderInfo(bool force) {
rv = db->HasNew(&hasnew);
if (NS_FAILED(rv)) return rv;
}
if (weOpenedDB) CloseDBIfFolderNotOpen(false);
}
} else {
// we tried to open DB but failed - don't keep trying.