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:
parent
9c0693f425
commit
46682568f5
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user