From 25accdec237e35b37710b514c52953f069547b56 Mon Sep 17 00:00:00 2001 From: Marcos Vitali Date: Thu, 29 Jul 2010 04:02:45 +0000 Subject: [PATCH] I add a CriticalSection in RemoveThreadsafeEvent for safety git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5992 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/CoreTiming.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Core/Core/Src/CoreTiming.cpp b/Source/Core/Core/Src/CoreTiming.cpp index 0da6c67f9c..dfcd677ffb 100644 --- a/Source/Core/Core/Src/CoreTiming.cpp +++ b/Source/Core/Core/Src/CoreTiming.cpp @@ -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)