diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 2e1437193..2dae75117 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -41,6 +41,7 @@ Bug fixes:: * core: fix delete of previous/next word (keys kbd:[Ctrl+w] and kbd:[Alt+d]) (issue #1195) * core: fix infinite loop in evaluation of strings (issue #1183) * core: change default value of option weechat.look.window_title from "WeeChat ${info:version}" to empty string (issue #1182) + * fset: fix crash when applying filters after closing the fset buffer (issue #1204) * irc: always set nick away status on WHO response (sent manually or automatically with server option "away_check") * irc: fix a crash when calling the function hdata_string on the "prefix" variable in the nick * irc: fix split of messages when server option "split_msg_max_length" is set to 0 (no split) (issue #1173) diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c index 149344975..29ffd2748 100644 --- a/src/core/wee-eval.c +++ b/src/core/wee-eval.c @@ -1235,6 +1235,7 @@ eval_expression (const char *expr, struct t_hashtable *pointers, { struct t_eval_context eval_context; int condition, rc, pointers_allocated, regex_allocated; + int ptr_window_added, ptr_buffer_added; char *value; const char *default_prefix = EVAL_DEFAULT_PREFIX; const char *default_suffix = EVAL_DEFAULT_SUFFIX; @@ -1250,6 +1251,8 @@ eval_expression (const char *expr, struct t_hashtable *pointers, regex_allocated = 0; regex = NULL; regex_replace = NULL; + ptr_window_added = 0; + ptr_buffer_added = 0; if (pointers) { @@ -1283,12 +1286,18 @@ eval_expression (const char *expr, struct t_hashtable *pointers, if (gui_current_window) { if (!hashtable_has_key (pointers, "window")) + { hashtable_set (pointers, "window", gui_current_window); + ptr_window_added = 1; + } if (!hashtable_has_key (pointers, "buffer")) { window = (struct t_gui_window *)hashtable_get (pointers, "window"); if (window) + { hashtable_set (pointers, "buffer", window->buffer); + ptr_buffer_added = 1; + } } } @@ -1366,7 +1375,16 @@ eval_expression (const char *expr, struct t_hashtable *pointers, } if (pointers_allocated) + { hashtable_free (pointers); + } + else + { + if (ptr_window_added) + hashtable_remove (pointers, "window"); + if (ptr_buffer_added) + hashtable_remove (pointers, "buffer"); + } if (regex && regex_allocated) { regfree (regex);