From f47419766d219b043ed368c062e40dc78e41ed6e Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 20 Dec 2022 15:42:26 +0800 Subject: [PATCH] Improve safety of calls to vendor-specific-keysyms * src/xterm.c (x_term_init): Wrap call to vendor-specific-keysyms inside safe_call. --- src/xterm.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index a1acfa80744..60d48165650 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -29894,13 +29894,17 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) { char *vendor = ServerVendor (dpy); - /* Temporarily hide the partially initialized terminal. */ + /* Temporarily hide the partially initialized terminal. + Use safe_call so that if a signal happens, a partially + initialized display (and display connection) is not + kept around. */ terminal_list = terminal->next_terminal; unblock_input (); - kset_system_key_alist - (terminal->kboard, - call1 (Qvendor_specific_keysyms, - vendor ? build_string (vendor) : empty_unibyte_string)); + kset_system_key_alist (terminal->kboard, + safe_call1 (Qvendor_specific_keysyms, + (vendor + ? build_string (vendor) + : empty_unibyte_string))); block_input (); terminal->next_terminal = terminal_list; terminal_list = terminal; -- 2.39.2