Bug 1930787 - Stop IMAP incoming servers trying to do things after shutting down. r=gds

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

--HG--
extra : rebase_source : 2c360df0590c6a1719a1d98af847370deae0605e
extra : amend_source : e3dc1a61ef60f206679418826b4f523781b1dfbf
This commit is contained in:
Geoff Lankow 2024-11-13 10:41:40 +13:00
Родитель 4971d003a8
Коммит 7cfd4b2ced
4 изменённых файлов: 8 добавлений и 1 удалений

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

@ -45,7 +45,8 @@
#define PORT_NOT_SET -1
nsMsgIncomingServer::nsMsgIncomingServer()
: m_rootFolder(nullptr),
: m_hasShutDown(false),
m_rootFolder(nullptr),
m_downloadedHdrs(50),
m_numMsgsDownloaded(0),
m_biffState(nsIMsgFolder::nsMsgBiffState_Unknown),
@ -295,6 +296,7 @@ NS_IMETHODIMP nsMsgIncomingServer::WriteToFolderCache(
NS_IMETHODIMP
nsMsgIncomingServer::Shutdown() {
nsresult rv = CloseCachedConnections();
m_hasShutDown = true;
mFilterPlugin = nullptr;
NS_ENSURE_SUCCESS(rv, rv);

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

@ -46,6 +46,7 @@ class nsMsgIncomingServer : public nsIMsgIncomingServer,
protected:
virtual ~nsMsgIncomingServer();
nsCString m_serverKey;
bool m_hasShutDown;
// Sets m_password, if password found. Can return NS_ERROR_ABORT if the
// user cancels the master password dialog.

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

@ -474,6 +474,7 @@ nsImapIncomingServer::RetryUrl(nsIImapUrl* aImapUrl,
NS_IMETHODIMP
nsImapIncomingServer::LoadNextQueuedUrl(nsIImapProtocol* aProtocol,
bool* aResult) {
if (m_hasShutDown) return NS_ERROR_FAILURE;
if (WeAreOffline()) return NS_MSG_ERROR_OFFLINE;
nsresult rv = NS_OK;

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

@ -2346,6 +2346,9 @@ NS_IMETHODIMP nsImapProtocol::LoadImapUrl(nsIURI* aURL,
m_imapMailFolderSink = nullptr;
rv = SetupWithUrl(aURL, aConsumer);
m_lastActiveTime = PR_Now();
if (NS_FAILED(rv)) {
TellThreadToDie(true);
}
}
return rv;
}