fix test case leak of mork rows and objects, r/sr=standard8, 498303
authorDavid Bienvenu <bienvenu@nventure.com>
Sat, 20 Jun 2009 09:44:22 -0700
changeset 2899 d285993e5dab24dc136a32d8429a226f510672a0
parent 2898 ffb301b5cd6b2e68a8cdf68cd05c0a493d8060dd
child 2900 2d3cf3e28937ae494ecaff9bf699305481dea68c
push idunknown
push userunknown
push dateunknown
bugs498303
fix test case leak of mork rows and objects, r/sr=standard8, 498303
mailnews/db/msgdb/src/nsMsgDatabase.cpp
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -381,16 +381,17 @@ nsresult nsMsgDatabase::AddHdrToCache(ns
 {
 
   MsgHdrHashElement* element = reinterpret_cast<MsgHdrHashElement*>(hdr);
   if (element && element->mHdr)
   {
     nsMsgHdr* msgHdr = static_cast<nsMsgHdr*>(element->mHdr);  // closed system, so this is ok
     // clear out m_mdbRow member variable - the db is going away, which means that this member
     // variable might very well point to a mork db that is gone.
+    NS_IF_RELEASE(msgHdr->m_mdbRow);
     msgHdr->m_mdbRow = nsnull;
   }
   return PL_DHASH_NEXT;
 }
 
 
 NS_IMETHODIMP nsMsgDatabase::SetMsgHdrCacheSize(PRUint32 aSize)
 {
@@ -416,17 +417,17 @@ NS_IMETHODIMP nsMsgDatabase::ClearCached
   }
 #endif
   return NS_OK;
 }
 
 void nsMsgDatabase::ClearCachedObjects(PRBool dbGoingAway)
 {
   ClearHdrCache(PR_FALSE);
-#ifdef DEBUG_bienvenu1
+#ifdef DEBUG_DavidBienvenu
   if (m_headersInUse && m_headersInUse->entryCount > 0)
   {
         NS_ASSERTION(PR_FALSE, "leaking headers");
     printf("leaking %d headers in %s\n", m_headersInUse->entryCount, (const char *) m_dbName);
   }
 #endif
   // We should only clear the use hdr cache when the db is going away, or we could
   // end up with multiple copies of the same logical msg hdr, which will lead to