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