mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-27 01:05:59 +01:00
pluginsystem: unload entire plugin before calling dlclose()
fixes #5689
This commit is contained in:
parent
e1644e91ea
commit
450343b7b8
1 changed files with 8 additions and 3 deletions
|
@ -119,11 +119,16 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
|
||||||
|
|
||||||
g_pConfigManager->removePluginConfig(plugin->m_pHandle);
|
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
|
// reload config to fix some stuf like e.g. unloadedPluginVars
|
||||||
g_pConfigManager->m_bForceReload = true;
|
g_pConfigManager->m_bForceReload = true;
|
||||||
|
|
Loading…
Reference in a new issue