Skip to content

Commit

Permalink
Fix regression when unloading plugins with entity vhooks on mapchange
Browse files Browse the repository at this point in the history
The previous fix in ac44af9 did not remove the hook itself instead of only not calling the removal callback. So yes, the removal callback wouldn't be called anymore, but the hook wouldn't be removed causing the normal hook callback to fire after the plugin unloaded.

Drifter321#3
  • Loading branch information
peace-maker committed Jun 17, 2020
1 parent d01af6a commit 9b9454b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ bool DHooks::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, boo

void DHooks::OnPluginUnloaded(IPlugin *plugin)
{
CleanupHooks(plugin->GetBaseContext());
RemoveAllCallbacksForContext(plugin->GetBaseContext());
if(g_pEntityListener)
{
g_pEntityListener->CleanupListeners(plugin->GetBaseContext());
}
CleanupHooks(plugin->GetBaseContext());
RemoveAllCallbacksForContext(plugin->GetBaseContext());
}
// The next 3 functions handle cleanup if our interfaces are going to be unloaded
bool DHooks::QueryRunning(char *error, size_t maxlength)
Expand Down
2 changes: 1 addition & 1 deletion listeners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void DHooksEntityListener::CleanupListeners(IPluginContext *pContext)
DHooksManager *manager = g_pRemoveList.at(i);
if (pContext == NULL || pContext == manager->callback->plugin_callback->GetParentRuntime()->GetDefaultContext())
{
g_pRemoveList.remove(i);
manager->remove_callback = nullptr;
}
}
}
Expand Down

0 comments on commit 9b9454b

Please sign in to comment.