diff --git a/mozilla/xpcom/threads/nsEventQueue.cpp b/mozilla/xpcom/threads/nsEventQueue.cpp index 04a945f2495..f7608beb048 100644 --- a/mozilla/xpcom/threads/nsEventQueue.cpp +++ b/mozilla/xpcom/threads/nsEventQueue.cpp @@ -135,7 +135,9 @@ nsEventQueueImpl::~nsEventQueueImpl() #endif if (mEventQueue) { - NotifyObservers(gDestroyedNotification); + // Perhaps CheckForDeactivation wasn't called... + if (mCouldHaveEvents) + NotifyObservers(gDestroyedNotification); PL_DestroyEventQueue(mEventQueue); } } @@ -236,6 +238,19 @@ nsEventQueueImpl::NotifyObservers(const char *aTopic) } } +void +nsEventQueueImpl::CheckForDeactivation() +{ + if (mCouldHaveEvents && !mAcceptingEvents && !PL_EventAvailable(mEventQueue)) { + if (PL_IsQueueOnCurrentThread(mEventQueue)) { + mCouldHaveEvents = PR_FALSE; + NotifyObservers(gDestroyedNotification); + NS_RELEASE_THIS(); // balance ADDREF from the constructor + } else + NS_ERROR("CheckForDeactivation called from wrong thread!"); + } +} + NS_IMETHODIMP nsEventQueueImpl::InitEvent(PLEvent* aEvent, diff --git a/mozilla/xpcom/threads/nsEventQueue.h b/mozilla/xpcom/threads/nsEventQueue.h index 51f33e478e4..7660e331a8b 100644 --- a/mozilla/xpcom/threads/nsEventQueue.h +++ b/mozilla/xpcom/threads/nsEventQueue.h @@ -75,15 +75,5 @@ private: nsPIEventQueueChain *mYoungerQueue; // but elder can't hold on to younger void NotifyObservers(const char *aTopic); - - void CheckForDeactivation() { - if (mCouldHaveEvents && !mAcceptingEvents && !PL_EventAvailable(mEventQueue)) { - if (PL_IsQueueOnCurrentThread(mEventQueue)) { - mCouldHaveEvents = PR_FALSE; - NS_RELEASE_THIS(); // balance ADDREF from the constructor - } else - NS_ERROR("CheckForDeactivation called from wrong thread!"); - } - } + void CheckForDeactivation(); }; -