mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 09:13:14 +02:00
script: track per-script theme contributions and purge on script unload
Make individual scripts the unit of ownership for theme contributions
so that loading a script that calls weechat.theme_register(...) and
later unloading it correctly removes the script's overrides.
Plugin API addition (weechat-plugin.h):
- new function pointer t_weechat_plugin.theme_unregister_script
delegates to core's theme_unregister_script.
- new convenience macro weechat_theme_unregister_script(script).
- WEECHAT_PLUGIN_API_VERSION bumped to 20260704-03.
Script API additions (plugin-script-api.{c,h}):
- new plugin_script_api_theme_register (plugin, script, name,
overrides) forwards to the plugin API with the script pointer
as the contribution owner, so contributions are tracked
per-script (not per script-language plugin).
Lifecycle wiring (plugin-script.c):
- new internal plugin_script_remove_themes (plugin, script)
calls weechat_theme_unregister_script.
- plugin_script_remove now calls it alongside the other
plugin_script_remove_* helpers, so script-unload tears down
everything (configs, bar items, themes, hooks).
Eight language bindings updated to call
plugin_script_api_theme_register instead of weechat_theme_register
directly, so they pass the script pointer as owner:
- python, perl, ruby, lua, tcl, javascript, php, guile.
This commit is contained in:
@@ -801,6 +801,7 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv)
|
||||
new_plugin->config_unset_plugin = &plugin_api_config_unset_plugin;
|
||||
|
||||
new_plugin->theme_register = &theme_register;
|
||||
new_plugin->theme_unregister_script = &theme_unregister_script;
|
||||
|
||||
new_plugin->key_bind = &gui_key_bind_plugin;
|
||||
new_plugin->key_unbind = &gui_key_unbind_plugin;
|
||||
|
||||
Reference in New Issue
Block a user