make sure we release imap url on the ui thread, r=standard, sr=neil, 330273
authorDavid Bienvenu <bienvenu@nventure.com>
Thu, 19 Mar 2009 07:41:46 -0700
changeset 2239 d2a8e9f48fa3c2f761fb763d23b01b69b34e1cde
parent 2238 55d050eb1dcac4b1da01d2c9ae238f1f0a71ff7d
child 2240 c09d5a915273974794927e305b01fb624ebd661d
push idunknown
push userunknown
push dateunknown
reviewersstandard, neil, 330273
bugs330273
make sure we release imap url on the ui thread, r=standard, sr=neil, 330273
mailnews/imap/src/nsImapProtocol.cpp
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -1029,18 +1029,24 @@ NS_IMETHODIMP nsImapProtocol::Run()
     }
 
   m_imapThreadIsRunning = PR_TRUE;
   PR_CExitMonitor(this);
 
   // call the platform specific main loop ....
   ImapThreadMainLoop();
 
-  m_runningUrl = nsnull;
-  
+  if (m_runningUrl)
+  {
+    nsCOMPtr<nsIThread> thread = do_GetMainThread();
+    nsIImapUrl *doomed = nsnull;
+    m_runningUrl.swap(doomed);
+    NS_ProxyRelease(thread, doomed);
+  }
+
   // close streams via UI thread if it's not already done
   if (m_imapProtocolSink)
     m_imapProtocolSink->CloseStreams();
     
   m_sinkEventTarget = nsnull;
   m_imapMailFolderSink = nsnull;
   m_imapMessageSink = nsnull;