Skip to content

Commit

Permalink
plugin-loader: add debug output for unloading plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ammen99 committed Mar 13, 2024
1 parent 78ff1b5 commit 34de8f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/core/plugin-loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ wf::plugin_manager_t::~plugin_manager_t()

void wf::plugin_manager_t::destroy_plugin(wf::loaded_plugin_t& p)
{
LOGD("Unloading plugin ", p.so_path);
p.instance->fini();
p.instance.reset();

Expand Down Expand Up @@ -130,6 +131,7 @@ std::optional<wf::loaded_plugin_t> wf::plugin_manager_t::load_plugin_from_file(s
loaded_plugin_t lp;
lp.instance = std::unique_ptr<wf::plugin_interface_t>(new_instance_func());
lp.so_handle = handle;
lp.so_path = path;
return lp;
}

Expand Down Expand Up @@ -228,20 +230,21 @@ void wf::plugin_manager_t::reload_dynamic_plugins()
}

template<class T>
static wf::loaded_plugin_t create_plugin()
static wf::loaded_plugin_t create_plugin(std::string name)
{
wf::loaded_plugin_t lp;
lp.instance = std::make_unique<T>();
lp.so_handle = nullptr;
lp.so_path = name;
lp.instance->init();
return lp;
}

void wf::plugin_manager_t::load_static_plugins()
{
loaded_plugins["_exit"] = create_plugin<wf::per_output_plugin_t<wayfire_exit>>();
loaded_plugins["_focus"] = create_plugin<wayfire_focus>();
loaded_plugins["_close"] = create_plugin<wf::per_output_plugin_t<wayfire_close>>();
loaded_plugins["_exit"] = create_plugin<wf::per_output_plugin_t<wayfire_exit>>("_exit");
loaded_plugins["_focus"] = create_plugin<wayfire_focus>("_focus");
loaded_plugins["_close"] = create_plugin<wf::per_output_plugin_t<wayfire_close>>("_close");
}

std::vector<std::string> wf::get_plugin_paths()
Expand Down
3 changes: 3 additions & 0 deletions src/core/plugin-loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ struct loaded_plugin_t

// A handle returned by dlopen().
void *so_handle;

// A path to the .so file of the plugin.
std::string so_path;
};

struct plugin_manager_t
Expand Down
1 change: 0 additions & 1 deletion src/output/workspace-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ std::vector<wayfire_toplevel_view> workspace_set_t::get_views(uint32_t flags, st

void workspace_set_t::remove_view(wayfire_toplevel_view view)
{
wf::print_trace(false);
pimpl->remove_view(view);
}

Expand Down

0 comments on commit 34de8f2

Please sign in to comment.