diff options
author | Jeremy Andrews <athenian200@outlook.com> | 2022-07-28 08:50:59 -0500 |
---|---|---|
committer | Jeremy Andrews <athenian200@outlook.com> | 2022-07-28 08:50:59 -0500 |
commit | b6734006391fbd757220e17cade7a7afd33ac6bc (patch) | |
tree | a847192aabecf9fde3ed7365ecbcbbc4869b6d5d | |
parent | cfe63a24341e345f67e3f02a4dc5ecaa8c53f1d5 (diff) | |
download | uxp-b6734006391fbd757220e17cade7a7afd33ac6bc.tar.gz |
Issue #1312 - Fix potential crashes in MailNews.
These are straightforward, one-line changes with no obvious dependencies. Probably could have been taken a long time ago.
Ref: BZ 1638634, 1606091
-rw-r--r-- | mailnews/base/src/nsMessenger.cpp | 14 | ||||
-rw-r--r-- | mailnews/imap/src/nsImapMailFolder.cpp | 1 |
2 files changed, 8 insertions, 7 deletions
diff --git a/mailnews/base/src/nsMessenger.cpp b/mailnews/base/src/nsMessenger.cpp index 953b462b6a..c9de533ae7 100644 --- a/mailnews/base/src/nsMessenger.cpp +++ b/mailnews/base/src/nsMessenger.cpp @@ -233,6 +233,13 @@ NS_IMETHODIMP nsMessenger::SetWindow(mozIDOMWindowProxy *aWin, nsIMsgWindow *aMs do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); + // Remove the folder listener if we added it, i.e. if mWindow is non-null + if (mWindow) + { + rv = mailSession->RemoveFolderListener(this); + NS_ENSURE_SUCCESS(rv, rv); + } + if (aWin) { mMsgWindow = aMsgWindow; @@ -271,13 +278,6 @@ NS_IMETHODIMP nsMessenger::SetWindow(mozIDOMWindowProxy *aWin, nsIMsgWindow *aMs } // if aWin else { - // Remove the folder listener if we added it, i.e. if mWindow is non-null - if (mWindow) - { - rv = mailSession->RemoveFolderListener(this); - NS_ENSURE_SUCCESS(rv, rv); - } - mWindow = nullptr; } diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index da1411cd08..1d08472bb9 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -1803,6 +1803,7 @@ nsImapMailFolder::GetImapIncomingServer(nsIImapIncomingServer **aImapIncomingSer if (NS_SUCCEEDED(GetServer(getter_AddRefs(server))) && server) { nsCOMPtr <nsIImapIncomingServer> incomingServer = do_QueryInterface(server); + NS_ENSURE_TRUE(incomingServer, NS_ERROR_NO_INTERFACE); incomingServer.swap(*aImapIncomingServer); return NS_OK; } |