From 4b776a91edbad3d636aaf7499d87ab341d8edcf9 Mon Sep 17 00:00:00 2001 From: GAMMACASE <31375974+GAMMACASE@users.noreply.github.com> Date: Wed, 12 Feb 2025 14:47:20 +0300 Subject: [PATCH] Prevent double plugin unload on ``meta retry`` --- core/metamod_plugins.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/metamod_plugins.cpp b/core/metamod_plugins.cpp index 01dd510..064d0d0 100644 --- a/core/metamod_plugins.cpp +++ b/core/metamod_plugins.cpp @@ -320,8 +320,9 @@ bool CPluginManager::Retry(PluginId id, char *error, size_t len) } else { - //don't really care about the buffer here - _Unload(pl, true, buffer, sizeof(buffer)-1); + //We don't need to handle any extra unloading, + //as if plugin has failed to load it would be + //unloaded by _Load() method itself //We just wasted an id... reclaim it m_LastId--; @@ -400,7 +401,8 @@ struct Unloader : public SourceHook::Impl::UnloadListener if (plugin_->m_UnloadFn != NULL) plugin_->m_UnloadFn(); - dlclose(plugin_->m_Lib); + if(plugin_->m_Lib) + dlclose(plugin_->m_Lib); if (destroy_) {