From 46682568f5e84d109b843f5524766374c40f426b Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Wed, 8 Aug 2018 00:34:41 +0200 Subject: [PATCH] Fix skipping plugin callbacks on plugin unload When removing a plugin's callback from the list of callbacks of a detour the next callback in the list would be skipped. Don't only check every second callback, but every single one! --- dynhooks_sourcepawn.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dynhooks_sourcepawn.cpp b/dynhooks_sourcepawn.cpp index 89a0c13..016f376 100644 --- a/dynhooks_sourcepawn.cpp +++ b/dynhooks_sourcepawn.cpp @@ -100,7 +100,7 @@ bool RemoveDetourPluginHook(HookType_t hookType, CHook *pDetour, IPluginFunction { bRemoved = true; delete pWrapper; - wrappers->remove(i--); + wrappers->remove(i); } } @@ -129,11 +129,11 @@ void RemoveAllCallbacksForContext(HookType_t hookType, DetourMap *map, IPluginCo for (int i = wrappers->length() - 1; i >= 0; i--) { pWrapper = wrappers->at(i); - if (pWrapper->plugin_callback->GetParentContext() != pContext) + if (pWrapper->plugin_callback->GetParentRuntime()->GetDefaultContext() != pContext) continue; delete pWrapper; - wrappers->remove(i--); + wrappers->remove(i); } // No plugin interested in this hook anymore. unhook.