Bug 461621 - Crash in nsNNTPProtocol::~nsNNTPProtocol() on shutdown after Tb is left open for some time; r=Pidgeot18 sr=bienvenu
authorSiddharth Agarwal <sid1337@gmail.com>
Wed, 29 Oct 2008 03:31:37 +0100
changeset 752 efd446a5a224268e2307d7a52682b750db80cef4
parent 751 e81e3f13af0e0a630bb675a5d38877c0a7098103
child 753 ea049a1644bdc5225e35393423a5f0e5bdff930d
push idunknown
push userunknown
push dateunknown
reviewersPidgeot18, bienvenu
bugs461621
Bug 461621 - Crash in nsNNTPProtocol::~nsNNTPProtocol() on shutdown after Tb is left open for some time; r=Pidgeot18 sr=bienvenu
mailnews/news/src/nsNntpIncomingServer.cpp
--- a/mailnews/news/src/nsNntpIncomingServer.cpp
+++ b/mailnews/news/src/nsNntpIncomingServer.cpp
@@ -438,17 +438,20 @@ nsNntpIncomingServer::CloseCachedConnect
   PRInt32 cnt = mConnectionCache.Count();
 
   for (PRInt32 i = 0; i < cnt; ++i)
   {
     connection = mConnectionCache[0];
     if (connection)
     {
       rv = connection->CloseConnection();
-      mConnectionCache.RemoveObjectAt(0);
+      // We need to do this instead of RemoveObjectAt(0) because the
+      // above call will likely cause the object to be removed from the
+      // array anyway
+      mConnectionCache.RemoveObject(connection);
     }
   }
 
   rv = WriteNewsrcFile();
   if (NS_FAILED(rv)) return rv;
 
   if (!mGetOnlyNew && !mHostInfoLoaded)
   {