diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-12-15 22:53:51 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-12-15 22:53:51 +0100 |
commit | 75dc8b9d6c2c2f816ecbeffa4d4b048ebc2d5f58 (patch) | |
tree | 0ef749137348dca1ee0acd2fdd07184b2cf835f8 /src/plugins/typing/typing.c | |
parent | 07fbd309487b7de977e5798e67e70de1bd2fed8a (diff) | |
download | weechat-75dc8b9d6c2c2f816ecbeffa4d4b048ebc2d5f58.zip |
core: fix crash on plugin reload when using musl libs (closes #2052)
Diffstat (limited to 'src/plugins/typing/typing.c')
-rw-r--r-- | src/plugins/typing/typing.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/plugins/typing/typing.c b/src/plugins/typing/typing.c index 8d02928d4..5231fa962 100644 --- a/src/plugins/typing/typing.c +++ b/src/plugins/typing/typing.c @@ -581,6 +581,45 @@ typing_setup_hooks () } /* + * Removes all hooks. + */ + +void +typing_remove_hooks () +{ + if (typing_signal_buffer_closing) + { + weechat_unhook (typing_signal_buffer_closing); + typing_signal_buffer_closing = NULL; + } + if (typing_signal_input_text_changed) + { + weechat_unhook (typing_signal_input_text_changed); + typing_signal_input_text_changed = NULL; + } + if (typing_modifier_input_text_for_buffer) + { + weechat_unhook (typing_modifier_input_text_for_buffer); + typing_modifier_input_text_for_buffer = NULL; + } + if (typing_timer) + { + weechat_unhook (typing_timer); + typing_timer = NULL; + } + if (typing_signal_typing_set_nick) + { + weechat_unhook (typing_signal_typing_set_nick); + typing_signal_typing_set_nick = NULL; + } + if (typing_signal_typing_reset_buffer) + { + weechat_unhook (typing_signal_typing_reset_buffer); + typing_signal_typing_reset_buffer = NULL; + } +} + +/* * Initializes typing plugin. */ @@ -615,6 +654,8 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) /* make C compiler happy */ (void) plugin; + typing_remove_hooks (); + typing_config_write (); typing_config_free (); |