diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/c_plugins.c | 2 | ||||
-rw-r--r-- | src/plugins/callbacks.c | 9 | ||||
-rw-r--r-- | src/plugins/callbacks.h | 1 | ||||
-rw-r--r-- | src/plugins/python_plugins.c | 1 |
4 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/c_plugins.c b/src/plugins/c_plugins.c index 7fe10905..5c0047c8 100644 --- a/src/plugins/c_plugins.c +++ b/src/plugins/c_plugins.c @@ -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 ()); } diff --git a/src/plugins/callbacks.c b/src/plugins/callbacks.c index a837e067..c0a25ca6 100644 --- a/src/plugins/callbacks.c +++ b/src/plugins/callbacks.c @@ -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) { diff --git a/src/plugins/callbacks.h b/src/plugins/callbacks.h index 8fd577fb..b73f80ff 100644 --- a/src/plugins/callbacks.h +++ b/src/plugins/callbacks.h @@ -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); diff --git a/src/plugins/python_plugins.c b/src/plugins/python_plugins.c index 7861f484..0dac55ec 100644 --- a/src/plugins/python_plugins.c +++ b/src/plugins/python_plugins.c @@ -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); |