Don't call sourcepawn detour callbacks from threads other than the main thread

The SourcePawn VM isn't threadsafe.
This commit is contained in:
Peace-Maker
2018-05-02 13:37:41 +02:00
parent 30fc311738
commit 9d43111829
3 changed files with 9 additions and 0 deletions
+4
View File
@@ -252,6 +252,10 @@ bool UpdateRegisterArgumentSizes(CHook* pDetour, HookSetup *setup)
// Central handler for all detours. Heart of the detour support.
ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
{
// Can't call into SourcePawn offthread.
if (g_MainThreadId != ke::GetCurrentThreadId())
return ReturnAction_Ignored;
DetourMap *map;
if (hookType == HOOKTYPE_PRE)
map = &g_pPreDetours;