diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2018-11-01 21:39:29 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2020-09-29 20:06:56 -0300 |
commit | f58165fd33919951e2ca594c6f19a785420fc4f9 (patch) | |
tree | d52c7cc1913ce5c628f6c904fdf0af0b2378ca48 /src | |
parent | aaa319735b9bef51d4f91c13c1bca766c0db968e (diff) |
Fix segfault feature/tor-i2p-dcc
https://github.com/hexchat/hexchat/issues/2265
Diffstat (limited to 'src')
-rw-r--r-- | src/common/plugin.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/common/plugin.c b/src/common/plugin.c index 86fd8449..0aa8859d 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -541,10 +541,13 @@ static int plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[], hexchat_event_attrs *attrs, int type) { + /* fix segfault https://github.com/hexchat/hexchat/issues/2265 */ + static int depth = 0; GSList *list, *next; hexchat_hook *hook; int ret, eat = 0; + depth++; list = hook_list; while (1) { @@ -590,18 +593,22 @@ plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[], } xit: - /* really remove deleted hooks now */ - list = hook_list; - while (list) + depth--; + if (!depth) { - hook = list->data; - next = list->next; - if (!hook || hook->type == HOOK_DELETED) + /* really remove deleted hooks now */ + list = hook_list; + while (list) { - hook_list = g_slist_remove (hook_list, hook); - g_free (hook); + hook = list->data; + next = list->next; + if (!hook || hook->type == HOOK_DELETED) + { + hook_list = g_slist_remove (hook_list, hook); + g_free (hook); + } + list = next; } - list = next; } return eat; |