From ca8ccf8c020e98efdaf91fb1b07c9ff871d7574a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 27 May 2026 21:08:53 +0200 Subject: [PATCH] core: auto-purge plugin contributions on plugin unload Call theme_unregister_plugin (plugin) from plugin_remove, right after config_file_free_all_plugin and before unhook_all_plugin. This drops every theme contribution whose plugin pointer matches the plugin being unloaded, so subsequent /theme apply runs no longer try to set options for an unloaded plugin and per-plugin contributions don't outlive the plugin. Script-owned contributions (plugin != NULL && script != NULL) are left intact - they are cleaned up per-script in the next commit. This commit is wiring only: the underlying theme_unregister_plugin function and its semantics are already covered by TEST(CoreTheme, UnregisterByOwner) in the previous commit. --- src/plugins/plugin.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 61d92ab88..20f84c44f 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -1217,6 +1217,9 @@ plugin_remove (struct t_weechat_plugin *plugin) /* remove all configuration files */ config_file_free_all_plugin (plugin); + /* remove all theme contributions registered by this plugin */ + theme_unregister_plugin (plugin); + /* remove all hooks */ unhook_all_plugin (plugin, NULL);