mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 21:27:20 +03:00
pluginsystem: unload entire plugin before calling dlclose()
fixes #5689
This commit is contained in:
parent
e1644e91ea
commit
450343b7b8
@ -119,11 +119,16 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
|
||||
|
||||
g_pConfigManager->removePluginConfig(plugin->m_pHandle);
|
||||
|
||||
dlclose(plugin->m_pHandle);
|
||||
// save these two for dlclose and a log,
|
||||
// as erase_if will kill the pointer
|
||||
const auto PLNAME = plugin->name;
|
||||
const auto PLHANDLE = plugin->m_pHandle;
|
||||
|
||||
Debug::log(LOG, " [PluginSystem] Plugin {} unloaded.", plugin->name);
|
||||
std::erase_if(m_vLoadedPlugins, [&](const auto& other) { return other->m_pHandle == PLHANDLE; });
|
||||
|
||||
std::erase_if(m_vLoadedPlugins, [&](const auto& other) { return other->m_pHandle == plugin->m_pHandle; });
|
||||
dlclose(PLHANDLE);
|
||||
|
||||
Debug::log(LOG, " [PluginSystem] Plugin {} unloaded.", PLNAME);
|
||||
|
||||
// reload config to fix some stuf like e.g. unloadedPluginVars
|
||||
g_pConfigManager->m_bForceReload = true;
|
||||
|
Loading…
Reference in New Issue
Block a user