fixes bug 273819 "ASSERTION: Native event queues should only be used on the main thread" r=danm, sr=bienvenu
git-svn-id: svn://10.0.0.236/trunk@166818 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user