From 67731f33de807aca1536ecb3cda0e9470ce4fd69 Mon Sep 17 00:00:00 2001 From: "vladimir@pobox.com" Date: Wed, 13 Feb 2008 22:51:06 -0800 Subject: [PATCH] b=417115, animated image causes recursion during shutdown ; r=stuart --- xpcom/threads/nsTimerImpl.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/xpcom/threads/nsTimerImpl.h b/xpcom/threads/nsTimerImpl.h index 98789b7cc74..dc2ce3cc6d9 100644 --- a/xpcom/threads/nsTimerImpl.h +++ b/xpcom/threads/nsTimerImpl.h @@ -110,11 +110,16 @@ private: void ReleaseCallback() { - if (mCallbackType == CALLBACK_TYPE_INTERFACE) + // if we're the last owner of the callback object, make + // sure that we don't recurse into ReleaseCallback in case + // the callback's destructor calls Cancel() or similar. + PRUint8 cbType = mCallbackType; + mCallbackType = CALLBACK_TYPE_UNKNOWN; + + if (cbType == CALLBACK_TYPE_INTERFACE) NS_RELEASE(mCallback.i); - else if (mCallbackType == CALLBACK_TYPE_OBSERVER) + else if (cbType == CALLBACK_TYPE_OBSERVER) NS_RELEASE(mCallback.o); - mCallbackType = CALLBACK_TYPE_UNKNOWN; } nsCOMPtr mCallingThread;