mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-31 04:01:56 -07:00
pluginsystem: unload entire plugin before calling dlclose()
fixes #5689
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user