I add a CriticalSection in RemoveThreadsafeEvent for safety

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5992 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Marcos Vitali 2010-07-29 04:02:45 +00:00
parent a72339b086
commit 25accdec23
1 changed files with 8 additions and 0 deletions

View File

@ -340,8 +340,12 @@ void RemoveEvent(int event_type)
void RemoveThreadsafeEvent(int event_type)
{
externalEventSection.Enter();
if (!tsFirst)
{
externalEventSection.Leave();
return;
}
if (tsFirst->type == event_type)
{
Event *next = tsFirst->next;
@ -349,7 +353,10 @@ void RemoveThreadsafeEvent(int event_type)
tsFirst = next;
}
if (!tsFirst)
{
externalEventSection.Leave();
return;
}
Event *prev = tsFirst;
Event *ptr = prev->next;
while (ptr)
@ -366,6 +373,7 @@ void RemoveThreadsafeEvent(int event_type)
ptr = ptr->next;
}
}
externalEventSection.Leave();
}
void RemoveAllEvents(int event_type)