Bug 489779 Crash [@ nsMsgSendLater::DoShutdownTask(nsIUrlListener*, nsIMsgWindow*, int*) ] whilst sending mail on shutdown. r/sr=bienvenu
authorMark Banner <bugzilla@standard8.plus.com>
Thu, 23 Apr 2009 19:47:19 +0100
changeset 2465 98ac446475076a6e56d6b6a7e3770b904e416fa3
parent 2464 eb7247133c36e3f19261840dd3197c9c460e0adf
child 2466 3fe3e732c210ebd3516ebbacc96e9acf963141bf
push idunknown
push userunknown
push dateunknown
bugs489779
Bug 489779 Crash [@ nsMsgSendLater::DoShutdownTask(nsIUrlListener*, nsIMsgWindow*, int*) ] whilst sending mail on shutdown. r/sr=bienvenu
mailnews/compose/src/nsMsgSendLater.cpp
--- a/mailnews/compose/src/nsMsgSendLater.cpp
+++ b/mailnews/compose/src/nsMsgSendLater.cpp
@@ -153,17 +153,21 @@ nsMsgSendLater::Init()
 }
 
 NS_IMETHODIMP
 nsMsgSendLater::Observe(nsISupports *aSubject, const char* aTopic,
                         const PRUnichar *aData)
 {
   if (aSubject == mTimer && !strcmp(aTopic, "timer-callback"))
   {
-    mTimer->Cancel();
+    if (mTimer)
+      mTimer->Cancel();
+    else
+      NS_ERROR("mTimer was null in nsMsgSendLater::Observe");
+
     mTimerSet = PR_FALSE;
     // If we've already started a send since the timer fired, don't start
     // another
     if (!mSendingMessages)
       InternalSendMessages(PR_FALSE, nsnull);
   }
   else if (!strcmp(aTopic, "quit-application"))
   {
@@ -1423,17 +1427,18 @@ nsMsgSendLater::GetNeedsToRunTask(PRBool
   *aResult = mSendingMessages;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgSendLater::DoShutdownTask(nsIUrlListener *aListener, nsIMsgWindow *aWindow,
                                PRBool *aResult)
 {
-  mTimer->Cancel();
+  if (mTimer)
+    mTimer->Cancel();
   // If we're already sending messages, nothing to do, but save the shutdown
   // listener until we've finished.
   if (mSendingMessages)
   {
     mShutdownListener = aListener;
     return NS_OK;
   }
   // Else we have pending messages, we need to throw up a dialog to find out