Bug 407201. Not dropping references for one shot timers on Fire. r/sr=bzbarsky
authorsayrer@gmail.com
Tue, 22 Jan 2008 21:20:14 -0800
changeset 10566 33b0e685fb6049ade0cc6f0698e93b9a5e1163c0
parent 10565 4ba1e59d2ea4f81cb96db8874ee5982b09cd7a89
child 10567 ab32e95877c898fbbeb6e1eb841df8443a628113
push idunknown
push userunknown
push dateunknown
bugs407201
milestone1.9b3pre
Bug 407201. Not dropping references for one shot timers on Fire. r/sr=bzbarsky
xpcom/threads/nsTimerImpl.cpp
--- a/xpcom/threads/nsTimerImpl.cpp
+++ b/xpcom/threads/nsTimerImpl.cpp
@@ -407,17 +407,18 @@ void nsTimerImpl::Fire()
                           NS_TIMER_CALLBACK_TOPIC,
                           nsnull);
       break;
     default:;
   }
 
   // If the callback didn't re-init the timer, and it's not a one-shot timer,
   // restore the callback state.
-  if (mCallbackType == CALLBACK_TYPE_UNKNOWN && callbackType != TYPE_ONE_SHOT) {
+  if (mCallbackType == CALLBACK_TYPE_UNKNOWN &&
+      mType != TYPE_ONE_SHOT && !mCanceled) {
     mCallback = callback;
     mCallbackType = callbackType;
   } else {
     // The timer was a one-shot, or the callback was reinitialized.
     if (callbackType == CALLBACK_TYPE_INTERFACE)
       NS_RELEASE(callback.i);
     else if (callbackType == CALLBACK_TYPE_OBSERVER)
       NS_RELEASE(callback.o);