mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-04 06:01:56 -07:00
Unload plugins on compositor cleanup (#1662)
This commit is contained in:
committed by
GitHub
parent
07b98952bc
commit
5c93f6947a
@@ -1,6 +1,7 @@
|
||||
#include "PluginSystem.hpp"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <ranges>
|
||||
#include "../Compositor.hpp"
|
||||
|
||||
CPluginSystem::CPluginSystem() {
|
||||
@@ -113,6 +114,11 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
|
||||
std::erase_if(m_vLoadedPlugins, [&](const auto& other) { return other->m_pHandle == plugin->m_pHandle; });
|
||||
}
|
||||
|
||||
void CPluginSystem::unloadAllPlugins() {
|
||||
for (auto& p : m_vLoadedPlugins | std::views::reverse)
|
||||
unloadPlugin(p.get(), false); // Unload remaining plugins gracefully
|
||||
}
|
||||
|
||||
CPlugin* CPluginSystem::getPluginByPath(const std::string& path) {
|
||||
for (auto& p : m_vLoadedPlugins) {
|
||||
if (p->path == path)
|
||||
@@ -136,4 +142,4 @@ std::vector<CPlugin*> CPluginSystem::getAllPlugins() {
|
||||
for (size_t i = 0; i < m_vLoadedPlugins.size(); ++i)
|
||||
results[i] = m_vLoadedPlugins[i].get();
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user