fix memory leak doing imap moves in filters, r/sr=standard8, 507285
authorDavid Bienvenu <bienvenu@nventure.com>
Thu, 13 Aug 2009 13:00:54 -0700
changeset 3298 35844f7e72018e42cd50be1ea8023d49d50e20da
parent 3297 20c7bfa51c75c6e0acb793243286c7c13bd1a93d
child 3299 6c421b0b5d95dae3b25ba2f2dced971e903d9f09
push idunknown
push userunknown
push dateunknown
bugs507285
fix memory leak doing imap moves in filters, r/sr=standard8, 507285
mailnews/local/src/nsParseMailbox.cpp
mailnews/local/src/nsParseMailbox.h
--- a/mailnews/local/src/nsParseMailbox.cpp
+++ b/mailnews/local/src/nsParseMailbox.cpp
@@ -1682,17 +1682,16 @@ int nsParseMailMessageState::FinalizeHea
 
 nsParseNewMailState::nsParseNewMailState()
     : m_disableFilters(PR_FALSE)
 {
   m_inboxFileStream = nsnull;
   m_ibuffer = nsnull;
   m_ibuffer_size = 0;
   m_ibuffer_fp = 0;
-  m_moveCoalescer = nsnull;
   m_numNotNewMessages = 0;
  }
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsParseNewMailState, nsMsgMailboxParser, nsIMsgFilterHitNotify)
 
 nsresult
 nsParseNewMailState::Init(nsIMsgFolder *serverFolder, nsIMsgFolder *downloadFolder, nsILocalFile *folder,
                           nsIInputStream *inboxFileStream, nsIMsgWindow *aMsgWindow,
--- a/mailnews/local/src/nsParseMailbox.h
+++ b/mailnews/local/src/nsParseMailbox.h
@@ -50,16 +50,17 @@
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsTime.h"
 #include "nsIDBChangeListener.h"
 #include "nsIWeakReference.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsIMsgWindow.h"
 #include "nsImapMoveCoalescer.h"
+#include "nsAutoPtr.h"
 
 #include "nsIMsgFilterList.h"
 #include "nsIMsgFilterHitNotify.h"
 #include "nsIMsgFolderNotificationService.h"
 
 class nsByteArray;
 class nsOutputFileStream;
 class nsIOFileStream;
@@ -273,17 +274,17 @@ protected:
 
   nsCOMPtr <nsIMsgFilterList> m_filterList;
   nsCOMPtr <nsIMsgFilterList> m_deferredToServerFilterList;
   nsCOMPtr <nsIMsgFolder> m_rootFolder;
   nsCOMPtr <nsIMsgWindow> m_msgWindow;
   nsCOMPtr <nsIMsgFolder> m_downloadFolder;
   nsCOMArray <nsIMsgFolder> m_filterTargetFolders;
 
-  nsImapMoveCoalescer *m_moveCoalescer; // strictly owned by nsParseNewMailState;
+  nsRefPtr<nsImapMoveCoalescer> m_moveCoalescer;
 
   PRBool        m_msgMovedByFilter;
   PRBool        m_msgCopiedByFilter;
   nsCOMPtr <nsIInputStream>  m_inboxFileStream;
   nsCOMPtr <nsILocalFile>    m_inboxFile;
   PRBool        m_disableFilters;
   PRBool        m_downloadingToTempFile;
   PRUint32      m_ibuffer_fp;