From aa690d71837cba60e901b384f5abd003ed9c782b Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 9 Aug 2014 00:36:15 +0100 Subject: [PATCH] Add lock around hook apply function --- renderdoc/os/win32/win32_hook.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/renderdoc/os/win32/win32_hook.cpp b/renderdoc/os/win32/win32_hook.cpp index 939d040d2..a69729857 100644 --- a/renderdoc/os/win32/win32_hook.cpp +++ b/renderdoc/os/win32/win32_hook.cpp @@ -25,6 +25,7 @@ #include "os/os_specific.h" #include "common/string_utils.h" +#include "common/threading.h" #include #include @@ -88,9 +89,12 @@ struct CachedHookData { map DllHooks; HMODULE module; + Threading::CriticalSection lock; void ApplyHooks(const char *modName, HMODULE module) { + SCOPED_LOCK(lock); + string name = strlower(string(modName)); // fraps seems to non-safely modify the assembly around the hook function, if