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:
darin%meer.net
2004-12-17 19:47:06 +00:00
parent fbcf2713ca
commit 2b63405c0c
2 changed files with 17 additions and 12 deletions

View File

@@ -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,