diff --git a/extension.cpp b/extension.cpp index 322f27a..c7e3105 100644 --- a/extension.cpp +++ b/extension.cpp @@ -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) diff --git a/listeners.cpp b/listeners.cpp index 2e3f751..478bddf 100644 --- a/listeners.cpp +++ b/listeners.cpp @@ -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; } } }