From 2b0c2747ade0b65c4d2bdeee2ee80c1529edb633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 21 Nov 2023 20:57:49 +0100 Subject: api: remove script hooks before buffers/bar items/configs This prevents a crash in some scripts that could use options after they are freed, with the call to hook config callback that has been enabled by commit 22602147977b42f4211697d77263be67c9506414. --- src/plugins/plugin-script.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c index 5737950f3..f6a538aaf 100644 --- a/src/plugins/plugin-script.c +++ b/src/plugins/plugin-script.c @@ -1054,15 +1054,15 @@ plugin_script_remove (struct t_weechat_plugin *weechat_plugin, { script->unloading = 1; + /* remove all hooks created by this script */ + weechat_unhook_all (script->name); + plugin_script_close_buffers (weechat_plugin, script); plugin_script_remove_bar_items (weechat_plugin, script); plugin_script_remove_configs (weechat_plugin, script); - /* remove all hooks created by this script */ - weechat_unhook_all (script->name); - /* remove script from list */ if (script->prev_script) (script->prev_script)->next_script = script->next_script; -- cgit v1.2.3