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!
This commit is contained in:
Peace-Maker 2018-08-08 00:34:41 +02:00
parent 9c0693f425
commit 46682568f5

View File

@ -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.