Added an assert and return so that eventQs only get

processed on the owning thread.  This fixes at least
18005 and 17065.  r=damn@netscape.com, a=chofmann.
This commit is contained in:
dougt%netscape.com 1999-12-13 23:05:31 +00:00
parent 939788219e
commit 0a71a2d506

View File

@ -190,6 +190,10 @@ nsEventQueueImpl::IsQueueOnCurrentThread(PRBool *aResult)
NS_IMETHODIMP
nsEventQueueImpl::ProcessPendingEvents()
{
PRBool correctThread = PL_IsQueueOnCurrentThread(mEventQueue);
NS_ASSERTION(correctThread, "attemping to process events on the wrong thread");
if (!correctThread)
return NS_ERROR_FAILURE;
PL_ProcessPendingEvents(mEventQueue);
CheckForDeactivation();
return NS_OK;
@ -198,6 +202,11 @@ nsEventQueueImpl::ProcessPendingEvents()
NS_IMETHODIMP
nsEventQueueImpl::EventLoop()
{
PRBool correctThread = PL_IsQueueOnCurrentThread(mEventQueue);
NS_ASSERTION(correctThread, "attemping to process events on the wrong thread");
if (!correctThread)
return NS_ERROR_FAILURE;
PL_EventLoop(mEventQueue);
return NS_OK;
}
@ -220,6 +229,11 @@ nsEventQueueImpl::GetEvent(PLEvent** aResult)
NS_IMETHODIMP
nsEventQueueImpl::HandleEvent(PLEvent* aEvent)
{
PRBool correctThread = PL_IsQueueOnCurrentThread(mEventQueue);
NS_ASSERTION(correctThread, "attemping to process events on the wrong thread");
if (!correctThread)
return NS_ERROR_FAILURE;
PL_HandleEvent(aEvent);
return NS_OK;
}
@ -227,6 +241,11 @@ nsEventQueueImpl::HandleEvent(PLEvent* aEvent)
NS_IMETHODIMP
nsEventQueueImpl::WaitForEvent()
{
PRBool correctThread = PL_IsQueueOnCurrentThread(mEventQueue);
NS_ASSERTION(correctThread, "attemping to process events on the wrong thread");
if (!correctThread)
return NS_ERROR_FAILURE;
PL_WaitForEvent(mEventQueue);
CheckForDeactivation();
return NS_OK;