From 55c751ffa4c6be98de609b178cac69aabd5a595a Mon Sep 17 00:00:00 2001 From: "bienvenu%nventure.com" Date: Fri, 6 Oct 2006 20:55:43 +0000 Subject: [PATCH] fix crash cancelling fcc to imap folder, sr=mscott, patch suggested by laurentiu dumitrescu 206408 --- mailnews/imap/src/nsImapProtocol.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index 05a9a842d00c..dcd510246444 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -1652,9 +1652,14 @@ nsresult nsImapProtocol::SendData(const char * dataBuffer, PRBool aSuppressLoggi else Log("SendData", nsnull, "Logging suppressed for this command (it probably contained authentication information)"); - PRUint32 n; - rv = m_outputStream->Write(dataBuffer, PL_strlen(dataBuffer), &n); - + { + // don't allow someone to close the stream/transport out from under us + // this can happen when the ui thread calls TellThreadToDie. + nsAutoCMonitor mon(this); + PRUint32 n; + if (m_outputStream) + rv = m_outputStream->Write(dataBuffer, PL_strlen(dataBuffer), &n); + } if (NS_FAILED(rv)) { Log("SendData", nsnull, "clearing IMAP_CONNECTION_IS_OPEN");