little fix for r6513 thank to metatheos for finding the error

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6518 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado 2010-12-04 22:04:46 +00:00
parent c8305a7b7d
commit 379fa47b6a
1 changed files with 31 additions and 32 deletions

View File

@ -306,15 +306,21 @@ bool IsScheduled(int event_type)
void RemoveEvent(int event_type)
{
if (!first)
return;
while(first)
{
if (first->type == event_type)
{
Event *next = first->next;
FreeEvent(first);
first = next;
}
else
{
break;
}
}
if (!first)
return;
Event *prev = first;
@ -343,12 +349,19 @@ void RemoveThreadsafeEvent(int event_type)
externalEventSection.Leave();
return;
}
while(tsFirst)
{
if (tsFirst->type == event_type)
{
Event *next = tsFirst->next;
FreeTsEvent(tsFirst);
tsFirst = next;
}
else
{
break;
}
}
if (!tsFirst)
{
externalEventSection.Leave();
@ -398,32 +411,18 @@ void ProcessFifoWaitEvents()
if (!first)
return;
while (first)
{
if (first->time <= globalTimer)
{
Event *next = first->next;
event_types[first->type].callback(first->userdata, (int)(globalTimer - first->time));
FreeEvent(first);
first = next;
}
if (!first)
return;
Event *prev = first;
Event *ptr = prev->next;
while (ptr)
{
if (ptr->time <= globalTimer)
{
prev->next = ptr->next;
event_types[ptr->type].callback(ptr->userdata, (int)(globalTimer - ptr->time));
FreeEvent(ptr);
ptr = prev->next;
Event* evt = first;
first = first->next;
event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));
FreeEvent(evt);
}
else
{
prev = ptr;
ptr = ptr->next;
break;
}
}
}