aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2017-09-17 22:01:56 -0700
committerPaul Eggert2017-09-17 22:03:00 -0700
commit059184e645037c947528ef4d8d512f6997613be2 (patch)
tree0554e5544c7ed80a6f79d3d4520f3e0c2aef8e78 /src
parent541006c53623cb5fb7dfae475baae5d64fc6e9d0 (diff)
downloademacs-059184e645037c947528ef4d8d512f6997613be2.tar.gz
emacs-059184e645037c947528ef4d8d512f6997613be2.zip
Avoid crash with C-g C-g in GC
Problem reported by Richard Stallman (Bug#17406). Based on fix suggested by Eli Zaretskii (Bug#28279#16). * src/term.c (tty_send_additional_strings): Use only safe accessors, to avoid crash when C-g C-g in GC.
Diffstat (limited to 'src')
-rw-r--r--src/term.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/term.c b/src/term.c
index a2ae8c2c6f0..065bce45d3c 100644
--- a/src/term.c
+++ b/src/term.c
@@ -155,12 +155,16 @@ tty_ring_bell (struct frame *f)
155static void 155static void
156tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym) 156tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym)
157{ 157{
158 Lisp_Object lisp_terminal; 158 /* Use only accessors like CDR_SAFE and assq_no_quit to avoid any
159 Lisp_Object extra_codes; 159 form of quitting or signaling an error, since this function can
160 run as part of the "emergency escape" procedure invoked in the
161 middle of GC, where quitting means crashing (Bug#17406). */
162 if (! terminal->name)
163 return;
160 struct tty_display_info *tty = terminal->display_info.tty; 164 struct tty_display_info *tty = terminal->display_info.tty;
161 165
162 XSETTERMINAL (lisp_terminal, terminal); 166 for (Lisp_Object extra_codes
163 for (extra_codes = Fterminal_parameter (lisp_terminal, sym); 167 = CDR_SAFE (assq_no_quit (sym, terminal->param_alist));
164 CONSP (extra_codes); 168 CONSP (extra_codes);
165 extra_codes = XCDR (extra_codes)) 169 extra_codes = XCDR (extra_codes))
166 { 170 {