mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Remove plugin callbacks in plugin_destroy functions
This commit is contained in:
parent
0d7b4cb4a7
commit
c8d09083a8
@ -523,6 +523,8 @@ c_plugin_destroy(ProfPlugin *plugin)
|
||||
{
|
||||
assert (plugin && plugin->module);
|
||||
|
||||
callbacks_remove(plugin->name);
|
||||
|
||||
if (dlclose (plugin->module)) {
|
||||
log_warning ("dlclose failed to close `%s' with `%s'", plugin->name, dlerror ());
|
||||
}
|
||||
|
@ -138,7 +138,14 @@ callbacks_init(void)
|
||||
p_window_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)_free_window_callbacks);
|
||||
}
|
||||
|
||||
// TODO move to plugin destroy functions
|
||||
void
|
||||
callbacks_remove(const char *const plugin_name)
|
||||
{
|
||||
g_hash_table_remove(p_commands, plugin_name);
|
||||
g_hash_table_remove(p_timed_functions, plugin_name);
|
||||
g_hash_table_remove(p_window_callbacks, plugin_name);
|
||||
}
|
||||
|
||||
void
|
||||
callbacks_close(void)
|
||||
{
|
||||
|
@ -64,6 +64,7 @@ typedef struct p_window_input_callback {
|
||||
} PluginWindowCallback;
|
||||
|
||||
void callbacks_init(void);
|
||||
void callbacks_remove(const char *const plugin_name);
|
||||
void callbacks_close(void);
|
||||
|
||||
void callbacks_add_command(const char *const plugin_name, PluginCommand *command);
|
||||
|
@ -889,6 +889,7 @@ void
|
||||
python_plugin_destroy(ProfPlugin *plugin)
|
||||
{
|
||||
disable_python_threads();
|
||||
callbacks_remove(plugin->name);
|
||||
free(plugin->name);
|
||||
Py_XDECREF(plugin->module);
|
||||
free(plugin);
|
||||
|
Loading…
Reference in New Issue
Block a user