summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-12-15 22:53:51 +0100
committerSébastien Helleu <flashcode@flashtux.org>2023-12-15 22:53:51 +0100
commit75dc8b9d6c2c2f816ecbeffa4d4b048ebc2d5f58 (patch)
tree0ef749137348dca1ee0acd2fdd07184b2cf835f8 /src
parent07fbd309487b7de977e5798e67e70de1bd2fed8a (diff)
downloadweechat-75dc8b9d6c2c2f816ecbeffa4d4b048ebc2d5f58.zip
core: fix crash on plugin reload when using musl libs (closes #2052)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/buflist/buflist-bar-item.c1
-rw-r--r--src/plugins/buflist/buflist-config.c10
-rw-r--r--src/plugins/buflist/buflist.c7
-rw-r--r--src/plugins/charset/charset.c7
-rw-r--r--src/plugins/exec/exec-config.c1
-rw-r--r--src/plugins/fifo/fifo-config.c1
-rw-r--r--src/plugins/fifo/fifo.c3
-rw-r--r--src/plugins/fset/fset-bar-item.c1
-rw-r--r--src/plugins/fset/fset-buffer.c20
-rw-r--r--src/plugins/fset/fset-config.c1
-rw-r--r--src/plugins/fset/fset-option.c5
-rw-r--r--src/plugins/guile/weechat-guile.c15
-rw-r--r--src/plugins/irc/irc-config.c1
-rw-r--r--src/plugins/irc/irc-list.c1
-rw-r--r--src/plugins/irc/irc-notify.c9
-rw-r--r--src/plugins/irc/irc-raw.c5
-rw-r--r--src/plugins/irc/irc.c6
-rw-r--r--src/plugins/javascript/weechat-js.cpp14
-rw-r--r--src/plugins/logger/logger-config.c1
-rw-r--r--src/plugins/lua/weechat-lua.c15
-rw-r--r--src/plugins/perl/weechat-perl.c15
-rw-r--r--src/plugins/php/weechat-php.c14
-rw-r--r--src/plugins/plugin-script.c1
-rw-r--r--src/plugins/python/weechat-python.c15
-rw-r--r--src/plugins/relay/relay-config.c1
-rw-r--r--src/plugins/relay/relay-network.c3
-rw-r--r--src/plugins/relay/relay.c9
-rw-r--r--src/plugins/ruby/weechat-ruby.c15
-rw-r--r--src/plugins/script/script-config.c1
-rw-r--r--src/plugins/script/script.c27
-rw-r--r--src/plugins/spell/spell-config.c7
-rw-r--r--src/plugins/spell/spell-speller.c3
-rw-r--r--src/plugins/spell/spell.c7
-rw-r--r--src/plugins/tcl/weechat-tcl.c15
-rw-r--r--src/plugins/trigger/trigger-buffer.c6
-rw-r--r--src/plugins/trigger/trigger-callback.c3
-rw-r--r--src/plugins/trigger/trigger-callback.h2
-rw-r--r--src/plugins/trigger/trigger-config.c1
-rw-r--r--src/plugins/trigger/trigger.c3
-rw-r--r--src/plugins/typing/typing-config.c1
-rw-r--r--src/plugins/typing/typing.c41
-rw-r--r--src/plugins/xfer/xfer.c10
42 files changed, 319 insertions, 5 deletions
diff --git a/src/plugins/buflist/buflist-bar-item.c b/src/plugins/buflist/buflist-bar-item.c
index 46c115b39..0b33452e2 100644
--- a/src/plugins/buflist/buflist-bar-item.c
+++ b/src/plugins/buflist/buflist-bar-item.c
@@ -768,6 +768,7 @@ buflist_bar_item_end ()
for (i = 0; i < BUFLIST_BAR_NUM_ITEMS; i++)
{
weechat_bar_item_remove (buflist_bar_item_buflist[i]);
+ buflist_bar_item_buflist[i] = NULL;
}
weechat_hashtable_free (buflist_hashtable_pointers);
diff --git a/src/plugins/buflist/buflist-config.c b/src/plugins/buflist/buflist-config.c
index 681ac6b99..468496461 100644
--- a/src/plugins/buflist/buflist-config.c
+++ b/src/plugins/buflist/buflist-config.c
@@ -844,6 +844,7 @@ buflist_config_free ()
int i;
weechat_config_free (buflist_config_file);
+ buflist_config_file = NULL;
if (buflist_config_signals_refresh)
buflist_config_free_signals_refresh ();
@@ -859,9 +860,18 @@ buflist_config_free ()
}
if (buflist_config_format_buffer_eval)
+ {
free (buflist_config_format_buffer_eval);
+ buflist_config_format_buffer_eval = NULL;
+ }
if (buflist_config_format_buffer_current_eval)
+ {
free (buflist_config_format_buffer_current_eval);
+ buflist_config_format_buffer_current_eval = NULL;
+ }
if (buflist_config_format_hotlist_eval)
+ {
free (buflist_config_format_hotlist_eval);
+ buflist_config_format_hotlist_eval = NULL;
+ }
}
diff --git a/src/plugins/buflist/buflist.c b/src/plugins/buflist/buflist.c
index e6061e616..ff404fc07 100644
--- a/src/plugins/buflist/buflist.c
+++ b/src/plugins/buflist/buflist.c
@@ -534,5 +534,12 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
buflist_config_write ();
buflist_config_free ();
+ buflist_hdata_window = NULL;
+ buflist_hdata_buffer = NULL;
+ buflist_hdata_hotlist = NULL;
+ buflist_hdata_bar = NULL;
+ buflist_hdata_bar_item = NULL;
+ buflist_hdata_bar_window = NULL;
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c
index fb3e3a110..543390f2e 100644
--- a/src/plugins/charset/charset.c
+++ b/src/plugins/charset/charset.c
@@ -639,11 +639,18 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
charset_config_write ();
weechat_config_free (charset_config_file);
+ charset_config_file = NULL;
if (charset_terminal)
+ {
free (charset_terminal);
+ charset_terminal = NULL;
+ }
if (charset_internal)
+ {
free (charset_internal);
+ charset_internal = NULL;
+ }
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/exec/exec-config.c b/src/plugins/exec/exec-config.c
index ba21ac65b..856e69b87 100644
--- a/src/plugins/exec/exec-config.c
+++ b/src/plugins/exec/exec-config.c
@@ -206,6 +206,7 @@ void
exec_config_free ()
{
weechat_config_free (exec_config_file);
+ exec_config_file = NULL;
if (exec_config_cmd_options)
{
diff --git a/src/plugins/fifo/fifo-config.c b/src/plugins/fifo/fifo-config.c
index e8dd23e9c..09058c58b 100644
--- a/src/plugins/fifo/fifo-config.c
+++ b/src/plugins/fifo/fifo-config.c
@@ -157,4 +157,5 @@ void
fifo_config_free ()
{
weechat_config_free (fifo_config_file);
+ fifo_config_file = NULL;
}
diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c
index 42c5e98df..309b332c9 100644
--- a/src/plugins/fifo/fifo.c
+++ b/src/plugins/fifo/fifo.c
@@ -367,6 +367,9 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_plugin = plugin;
+ fifo_quiet = 0;
+ fifo_fd = -1;
+
if (!fifo_config_init ())
return WEECHAT_RC_ERROR;
diff --git a/src/plugins/fset/fset-bar-item.c b/src/plugins/fset/fset-bar-item.c
index feaf1fc7f..5ecc89de3 100644
--- a/src/plugins/fset/fset-bar-item.c
+++ b/src/plugins/fset/fset-bar-item.c
@@ -248,4 +248,5 @@ void
fset_bar_item_end ()
{
weechat_bar_item_remove (fset_bar_item_fset);
+ fset_bar_item_fset = NULL;
}
diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c
index c7a69ae54..4684973d7 100644
--- a/src/plugins/fset/fset-buffer.c
+++ b/src/plugins/fset/fset-buffer.c
@@ -1654,9 +1654,21 @@ fset_buffer_init ()
void
fset_buffer_end ()
{
- weechat_hashtable_free (fset_buffer_hashtable_pointers);
- fset_buffer_hashtable_pointers = NULL;
+ if (fset_buffer)
+ {
+ weechat_buffer_close (fset_buffer);
+ fset_buffer = NULL;
+ }
- weechat_hashtable_free (fset_buffer_hashtable_extra_vars);
- fset_buffer_hashtable_extra_vars = NULL;
+ if (fset_buffer_hashtable_pointers)
+ {
+ weechat_hashtable_free (fset_buffer_hashtable_pointers);
+ fset_buffer_hashtable_pointers = NULL;
+ }
+
+ if (fset_buffer_hashtable_extra_vars)
+ {
+ weechat_hashtable_free (fset_buffer_hashtable_extra_vars);
+ fset_buffer_hashtable_extra_vars = NULL;
+ }
}
diff --git a/src/plugins/fset/fset-config.c b/src/plugins/fset/fset-config.c
index 886a403c9..85c0e00cc 100644
--- a/src/plugins/fset/fset-config.c
+++ b/src/plugins/fset/fset-config.c
@@ -1186,6 +1186,7 @@ void
fset_config_free ()
{
weechat_config_free (fset_config_file);
+ fset_config_file = NULL;
if (fset_config_auto_refresh)
{
diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c
index b478569d3..1a2020c1f 100644
--- a/src/plugins/fset/fset-option.c
+++ b/src/plugins/fset/fset-option.c
@@ -1934,4 +1934,9 @@ fset_option_end ()
weechat_hashtable_free (fset_option_timer_options_changed);
fset_option_timer_options_changed = NULL;
}
+ if (fset_option_timer_hook)
+ {
+ weechat_unhook (fset_option_timer_hook);
+ fset_option_timer_hook = NULL;
+ }
}
diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c
index 678cbd5cd..c93f16eb4 100644
--- a/src/plugins/guile/weechat-guile.c
+++ b/src/plugins/guile/weechat-guile.c
@@ -1258,6 +1258,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_guile_plugin = plugin;
+ guile_quiet = 0;
+ guile_eval_mode = 0;
+ guile_eval_send_input = 0;
+ guile_eval_exec_commands = 0;
+
/* set interpreter name and version */
weechat_hashtable_set (plugin->variables, "interpreter_name",
plugin->name);
@@ -1354,12 +1359,22 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* free some data */
if (guile_action_install_list)
+ {
free (guile_action_install_list);
+ guile_action_install_list = NULL;
+ }
if (guile_action_remove_list)
+ {
free (guile_action_remove_list);
+ guile_action_remove_list = NULL;
+ }
if (guile_action_autoload_list)
+ {
free (guile_action_autoload_list);
+ guile_action_autoload_list = NULL;
+ }
weechat_string_dyn_free (guile_buffer_output, 1);
+ guile_buffer_output = NULL;
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index e023c7dc6..ad12fe87b 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -4106,6 +4106,7 @@ void
irc_config_free ()
{
weechat_config_free (irc_config_file);
+ irc_config_file = NULL;
if (irc_config_hook_config_nick_color_options)
{
diff --git a/src/plugins/irc/irc-list.c b/src/plugins/irc/irc-list.c
index 2d509753c..0a2e41940 100644
--- a/src/plugins/irc/irc-list.c
+++ b/src/plugins/irc/irc-list.c
@@ -1340,4 +1340,5 @@ irc_list_end ()
weechat_hashtable_free (irc_list_filter_hashtable_options);
irc_list_filter_hashtable_options = NULL;
}
+ irc_list_hdata_list_channel = NULL;
}
diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c
index 085faa5aa..3fc19ef37 100644
--- a/src/plugins/irc/irc-notify.c
+++ b/src/plugins/irc/irc-notify.c
@@ -1307,9 +1307,18 @@ void
irc_notify_end ()
{
if (irc_notify_timer_ison)
+ {
weechat_unhook (irc_notify_timer_ison);
+ irc_notify_timer_ison = NULL;
+ }
if (irc_notify_timer_whois)
+ {
weechat_unhook (irc_notify_timer_whois);
+ irc_notify_timer_whois = NULL;
+ }
if (irc_notify_hsignal)
+ {
weechat_unhook (irc_notify_hsignal);
+ irc_notify_hsignal = NULL;
+ }
}
diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c
index 83513a3a8..43918cd10 100644
--- a/src/plugins/irc/irc-raw.c
+++ b/src/plugins/irc/irc-raw.c
@@ -673,6 +673,11 @@ irc_raw_end ()
{
irc_raw_message_free_all ();
+ if (irc_raw_buffer)
+ {
+ weechat_buffer_close (irc_raw_buffer);
+ irc_raw_buffer = NULL;
+ }
if (irc_raw_filter)
{
free (irc_raw_filter);
diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c
index a978530c4..4c0b34235 100644
--- a/src/plugins/irc/irc.c
+++ b/src/plugins/irc/irc.c
@@ -193,6 +193,9 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_plugin = plugin;
+ irc_signal_quit_received = 0;
+ irc_signal_upgrade_received = 0;
+
if (!irc_config_init ())
return WEECHAT_RC_ERROR;
@@ -314,7 +317,10 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
(void) plugin;
if (irc_hook_timer)
+ {
weechat_unhook (irc_hook_timer);
+ irc_hook_timer = NULL;
+ }
if (irc_signal_upgrade_received)
{
diff --git a/src/plugins/javascript/weechat-js.cpp b/src/plugins/javascript/weechat-js.cpp
index 446586396..2a8780310 100644
--- a/src/plugins/javascript/weechat-js.cpp
+++ b/src/plugins/javascript/weechat-js.cpp
@@ -930,6 +930,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_js_plugin = plugin;
+ js_quiet = 0;
+ js_eval_mode = 0;
+ js_eval_send_input = 0;
+ js_eval_exec_commands = 0;
+
/* set interpreter name and version */
snprintf (str_interpreter, sizeof (str_interpreter),
"%s (v8)", plugin->name);
@@ -980,11 +985,20 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* free some data */
if (js_action_install_list)
+ {
free (js_action_install_list);
+ js_action_install_list = NULL;
+ }
if (js_action_remove_list)
+ {
free (js_action_remove_list);
+ js_action_remove_list = NULL;
+ }
if (js_action_autoload_list)
+ {
free (js_action_autoload_list);
+ js_action_autoload_list = NULL;
+ }
/* weechat_string_dyn_free (js_buffer_output, 1); */
return WEECHAT_RC_OK;
diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c
index 287dffb10..0a5810234 100644
--- a/src/plugins/logger/logger-config.c
+++ b/src/plugins/logger/logger-config.c
@@ -780,4 +780,5 @@ void
logger_config_free ()
{
weechat_config_free (logger_config_file);
+ logger_config_file = NULL;
}
diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c
index 3686fa6d1..616f03b39 100644
--- a/src/plugins/lua/weechat-lua.c
+++ b/src/plugins/lua/weechat-lua.c
@@ -1243,6 +1243,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_lua_plugin = plugin;
+ lua_quiet = 0;
+ lua_eval_mode = 0;
+ lua_eval_send_input = 0;
+ lua_eval_exec_commands = 0;
+
/* set interpreter name and version */
weechat_hashtable_set (plugin->variables, "interpreter_name",
plugin->name);
@@ -1304,12 +1309,22 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* free some data */
if (lua_action_install_list)
+ {
free (lua_action_install_list);
+ lua_action_install_list = NULL;
+ }
if (lua_action_remove_list)
+ {
free (lua_action_remove_list);
+ lua_action_remove_list = NULL;
+ }
if (lua_action_autoload_list)
+ {
free (lua_action_autoload_list);
+ lua_action_autoload_list = NULL;
+ }
weechat_string_dyn_free (lua_buffer_output, 1);
+ lua_buffer_output = NULL;
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c
index c851d2672..dc0a276bd 100644
--- a/src/plugins/perl/weechat-perl.c
+++ b/src/plugins/perl/weechat-perl.c
@@ -1264,6 +1264,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_perl_plugin = plugin;
+ perl_quiet = 0;
+ perl_eval_mode = 0;
+ perl_eval_send_input = 0;
+ perl_eval_exec_commands = 0;
+
/* set interpreter name and version */
weechat_hashtable_set (plugin->variables, "interpreter_name",
plugin->name);
@@ -1368,12 +1373,22 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* free some data */
if (perl_action_install_list)
+ {
free (perl_action_install_list);
+ perl_action_install_list = NULL;
+ }
if (perl_action_remove_list)
+ {
free (perl_action_remove_list);
+ perl_action_remove_list = NULL;
+ }
if (perl_action_autoload_list)
+ {
free (perl_action_autoload_list);
+ perl_action_autoload_list = NULL;
+ }
weechat_string_dyn_free (perl_buffer_output, 1);
+ perl_buffer_output = NULL;
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c
index 39d909557..8a5534916 100644
--- a/src/plugins/php/weechat-php.c
+++ b/src/plugins/php/weechat-php.c
@@ -1311,6 +1311,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_php_plugin = plugin;
+ php_quiet = 0;
+ php_eval_mode = 0;
+ php_eval_send_input = 0;
+ php_eval_exec_commands = 0;
+
/* set interpreter name and version */
weechat_hashtable_set (plugin->variables, "interpreter_name",
plugin->name);
@@ -1385,11 +1390,20 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
php_embed_shutdown ();
if (php_action_install_list)
+ {
free (php_action_install_list);
+ php_action_install_list = NULL;
+ }
if (php_action_remove_list)
+ {
free (php_action_remove_list);
+ php_action_remove_list = NULL;
+ }
if (php_action_autoload_list)
+ {
free (php_action_autoload_list);
+ php_action_autoload_list = NULL;
+ }
/* weechat_string_dyn_free (php_buffer_output, 1); */
return WEECHAT_RC_OK;
diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c
index f6a538aaf..d41736616 100644
--- a/src/plugins/plugin-script.c
+++ b/src/plugins/plugin-script.c
@@ -1797,6 +1797,7 @@ plugin_script_end (struct t_weechat_plugin *weechat_plugin,
/* write config file (file: "<language>.conf") */
weechat_config_write (*(plugin_data->config_file));
weechat_config_free (*(plugin_data->config_file));
+ *(plugin_data->config_file) = NULL;
}
/*
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c
index 4fedb3e7f..391c4cd4d 100644
--- a/src/plugins/python/weechat-python.c
+++ b/src/plugins/python/weechat-python.c
@@ -1471,6 +1471,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_python_plugin = plugin;
+ python_quiet = 0;
+ python_eval_mode = 0;
+ python_eval_send_input = 0;
+ python_eval_exec_commands = 0;
+
/* set interpreter name and version */
weechat_hashtable_set (plugin->variables, "interpreter_name",
plugin->name);
@@ -1582,12 +1587,22 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* free some data */
if (python_action_install_list)
+ {
free (python_action_install_list);
+ python_action_install_list = NULL;
+ }
if (python_action_remove_list)
+ {
free (python_action_remove_list);
+ python_action_remove_list = NULL;
+ }
if (python_action_autoload_list)
+ {
free (python_action_autoload_list);
+ python_action_autoload_list = NULL;
+ }
weechat_string_dyn_free (python_buffer_output, 1);
+ python_buffer_output = NULL;
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c
index c7765f9ad..147560ad9 100644
--- a/src/plugins/relay/relay-config.c
+++ b/src/plugins/relay/relay-config.c
@@ -1460,6 +1460,7 @@ void
relay_config_free ()
{
weechat_config_free (relay_config_file);
+ relay_config_file = NULL;
if (relay_config_regex_allowed_ips)
{
diff --git a/src/plugins/relay/relay-network.c b/src/plugins/relay/relay-network.c
index 6f7003027..67e5d9e3d 100644
--- a/src/plugins/relay/relay-network.c
+++ b/src/plugins/relay/relay-network.c
@@ -162,6 +162,9 @@ relay_network_set_priority ()
void
relay_network_init ()
{
+ relay_network_init_ok = 0;
+ relay_network_init_tls_cert_key_ok = 0;
+
/* credentials */
gnutls_certificate_allocate_credentials (&relay_gnutls_x509_cred);
relay_network_set_tls_cert_key (0);
diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c
index 9e1c3f6b2..f3bd2c8dc 100644
--- a/src/plugins/relay/relay.c
+++ b/src/plugins/relay/relay.c
@@ -203,6 +203,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_plugin = plugin;
+ relay_signal_upgrade_received = 0;
+
if (!relay_config_init ())
return WEECHAT_RC_ERROR;
@@ -240,7 +242,10 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
(void) plugin;
if (relay_hook_timer)
+ {
weechat_unhook (relay_hook_timer);
+ relay_hook_timer = NULL;
+ }
relay_config_write ();
@@ -254,7 +259,11 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
relay_server_free_all ();
if (relay_buffer)
+ {
weechat_buffer_close (relay_buffer);
+ relay_buffer = NULL;
+ }
+ relay_buffer_selected_line = 0;
relay_client_free_all ();
diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c
index 02f74b072..c78001f84 100644
--- a/src/plugins/ruby/weechat-ruby.c
+++ b/src/plugins/ruby/weechat-ruby.c
@@ -1336,6 +1336,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_ruby_plugin = plugin;
+ ruby_quiet = 0;
+ ruby_eval_mode = 0;
+ ruby_eval_send_input = 0;
+ ruby_eval_exec_commands = 0;
+
/* set interpreter name and version */
weechat_hashtable_set (plugin->variables, "interpreter_name",
plugin->name);
@@ -1439,12 +1444,22 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* free some data */
if (ruby_action_install_list)
+ {
free (ruby_action_install_list);
+ ruby_action_install_list = NULL;
+ }
if (ruby_action_remove_list)
+ {
free (ruby_action_remove_list);
+ ruby_action_remove_list = NULL;
+ }
if (ruby_action_autoload_list)
+ {
free (ruby_action_autoload_list);
+ ruby_action_autoload_list = NULL;
+ }
weechat_string_dyn_free (ruby_buffer_output, 1);
+ ruby_buffer_output = NULL;
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c
index 28b6c81a5..64912a3da 100644
--- a/src/plugins/script/script-config.c
+++ b/src/plugins/script/script-config.c
@@ -840,4 +840,5 @@ void
script_config_free ()
{
weechat_config_free (script_config_file);
+ script_config_file = NULL;
}
diff --git a/src/plugins/script/script.c b/src/plugins/script/script.c
index f04ccb248..7679e9806 100644
--- a/src/plugins/script/script.c
+++ b/src/plugins/script/script.c
@@ -386,6 +386,27 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* make C compiler happy */
(void) plugin;
+ if (script_loaded)
+ {
+ weechat_hashtable_free (script_loaded);
+ script_loaded = NULL;
+ }
+ if (script_timer_refresh)
+ {
+ weechat_unhook (script_timer_refresh);
+ script_timer_refresh = NULL;
+ }
+
+ if (script_buffer)
+ {
+ weechat_buffer_close (script_buffer);
+ script_buffer = NULL;
+ }
+ script_buffer_selected_line = 0;
+ script_buffer_detail_script = NULL;
+ script_buffer_detail_script_last_line = 0;
+ script_buffer_detail_script_line_diff = -1;
+
script_mouse_end ();
script_config_write ();
@@ -393,10 +414,16 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
script_repo_remove_all ();
if (script_repo_filter)
+ {
free (script_repo_filter);
+ script_repo_filter = NULL;
+ }
if (script_loaded)
+ {
weechat_hashtable_free (script_loaded);
+ script_loaded = NULL;
+ }
script_config_free ();
diff --git a/src/plugins/spell/spell-config.c b/src/plugins/spell/spell-config.c
index 9bab0dfcb..b1d0f6d80 100644
--- a/src/plugins/spell/spell-config.c
+++ b/src/plugins/spell/spell-config.c
@@ -654,9 +654,16 @@ void
spell_config_free ()
{
weechat_config_free (spell_config_file);
+ spell_config_file = NULL;
if (spell_commands_to_check)
+ {
weechat_string_free_split (spell_commands_to_check);
+ spell_commands_to_check = NULL;
+ }
if (spell_length_commands_to_check)
+ {
free (spell_length_commands_to_check);
+ spell_length_commands_to_check = NULL;
+ }
}
diff --git a/src/plugins/spell/spell-speller.c b/src/plugins/spell/spell-speller.c
index 69124aa43..9ca948765 100644
--- a/src/plugins/spell/spell-speller.c
+++ b/src/plugins/spell/spell-speller.c
@@ -501,5 +501,8 @@ void
spell_speller_end ()
{
weechat_hashtable_free (spell_spellers);
+ spell_spellers = NULL;
+
weechat_hashtable_free (spell_speller_buffer);
+ spell_speller_buffer = NULL;
}
diff --git a/src/plugins/spell/spell.c b/src/plugins/spell/spell.c
index 68d96ec9a..76541d7db 100644
--- a/src/plugins/spell/spell.c
+++ b/src/plugins/spell/spell.c
@@ -1188,6 +1188,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_plugin = plugin;
+ spell_enabled = 0;
+
spell_warning_aspell_config ();
#ifdef USE_ENCHANT
@@ -1260,10 +1262,15 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
#ifdef USE_ENCHANT
/* release enchant broker */
enchant_broker_free (broker);
+ broker = NULL;
#endif /* USE_ENCHANT */
if (spell_nick_completer)
+ {
free (spell_nick_completer);
+ spell_nick_completer = NULL;
+ }
+ spell_len_nick_completer = 0;
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c
index b202e7c44..55dab3baa 100644
--- a/src/plugins/tcl/weechat-tcl.c
+++ b/src/plugins/tcl/weechat-tcl.c
@@ -56,7 +56,6 @@ struct t_plugin_script *tcl_script_eval = NULL;
int tcl_eval_mode = 0;
int tcl_eval_send_input = 0;
int tcl_eval_exec_commands = 0;
-struct t_gui_buffer *tcl_eval_buffer = NULL;
struct t_plugin_script *tcl_scripts = NULL;
struct t_plugin_script *last_tcl_script = NULL;
@@ -928,6 +927,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_tcl_plugin = plugin;
+ tcl_quiet = 0;
+ tcl_eval_mode = 0;
+ tcl_eval_send_input = 0;
+ tcl_eval_exec_commands = 0;
+
/* set interpreter name and version */
weechat_hashtable_set (plugin->variables, "interpreter_name",
plugin->name);
@@ -984,11 +988,20 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* free some data */
if (tcl_action_install_list)
+ {
free (tcl_action_install_list);
+ tcl_action_install_list = NULL;
+ }
if (tcl_action_remove_list)
+ {
free (tcl_action_remove_list);
+ tcl_action_remove_list = NULL;
+ }
if (tcl_action_autoload_list)
+ {
free (tcl_action_autoload_list);
+ tcl_action_autoload_list = NULL;
+ }
/* weechat_string_dyn_free (tcl_buffer_output, 1); */
return WEECHAT_RC_OK;
diff --git a/src/plugins/trigger/trigger-buffer.c b/src/plugins/trigger/trigger-buffer.c
index 3ca397a96..eb83c3f1f 100644
--- a/src/plugins/trigger/trigger-buffer.c
+++ b/src/plugins/trigger/trigger-buffer.c
@@ -388,6 +388,12 @@ trigger_buffer_display_trigger (struct t_trigger *trigger,
void
trigger_buffer_end ()
{
+ if (trigger_buffer)
+ {
+ weechat_buffer_close (trigger_buffer);
+ trigger_buffer = NULL;
+ }
+
if (trigger_buffer_filters)
{
weechat_string_free_split (trigger_buffer_filters);
diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c
index 0e3371e7a..d9f307688 100644
--- a/src/plugins/trigger/trigger-callback.c
+++ b/src/plugins/trigger/trigger-callback.c
@@ -1534,5 +1534,8 @@ void
trigger_callback_end ()
{
if (trigger_callback_hashtable_options_conditions)
+ {
weechat_hashtable_free (trigger_callback_hashtable_options_conditions);
+ trigger_callback_hashtable_options_conditions = NULL;
+ }
}
diff --git a/src/plugins/trigger/trigger-callback.h b/src/plugins/trigger/trigger-callback.h
index a6ce93fba..b04eb1633 100644
--- a/src/plugins/trigger/trigger-callback.h
+++ b/src/plugins/trigger/trigger-callback.h
@@ -105,6 +105,8 @@ struct t_trigger_context
} \
return __rc;
+extern unsigned long trigger_context_id;
+
extern int trigger_callback_signal_cb (const void *pointer, void *data,
const char *signal,
const char *type_data,
diff --git a/src/plugins/trigger/trigger-config.c b/src/plugins/trigger/trigger-config.c
index 56bdbf4d2..4694a1895 100644
--- a/src/plugins/trigger/trigger-config.c
+++ b/src/plugins/trigger/trigger-config.c
@@ -831,4 +831,5 @@ void
trigger_config_free ()
{
weechat_config_free (trigger_config_file);
+ trigger_config_file = NULL;
}
diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c
index 4c163caac..7fe778b8b 100644
--- a/src/plugins/trigger/trigger.c
+++ b/src/plugins/trigger/trigger.c
@@ -1391,6 +1391,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_plugin = plugin;
+ trigger_enabled = 1;
+
trigger_callback_init ();
trigger_command_init ();
@@ -1427,6 +1429,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
trigger_free_all ();
trigger_config_free ();
trigger_callback_end ();
+ trigger_context_id = 0;
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/typing/typing-config.c b/src/plugins/typing/typing-config.c
index 6b2b79b98..4acd6e649 100644
--- a/src/plugins/typing/typing-config.c
+++ b/src/plugins/typing/typing-config.c
@@ -218,4 +218,5 @@ void
typing_config_free ()
{
weechat_config_free (typing_config_file);
+ typing_config_file = NULL;
}
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 ();
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index 314c512b1..513a965d2 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -1838,6 +1838,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_plugin = plugin;
+ xfer_signal_upgrade_received = 0;
+
if (!xfer_config_init ())
return WEECHAT_RC_ERROR;
@@ -1880,6 +1882,13 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* make C compiler happy */
(void) plugin;
+ if (xfer_buffer)
+ {
+ weechat_buffer_close (xfer_buffer);
+ xfer_buffer = NULL;
+ }
+ xfer_buffer_selected_line = 0;
+
xfer_config_write ();
if (xfer_signal_upgrade_received)
@@ -1890,6 +1899,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
xfer_free_all ();
weechat_config_free (xfer_config_file);
+ xfer_config_file = NULL;
return WEECHAT_RC_OK;
}