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