emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 059184e: Avoid crash with C-g C-g in GC


From: Paul Eggert
Subject: [Emacs-diffs] emacs-26 059184e: Avoid crash with C-g C-g in GC
Date: Mon, 18 Sep 2017 01:03:06 -0400 (EDT)

branch: emacs-26
commit 059184e645037c947528ef4d8d512f6997613be2
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 src/term.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/term.c b/src/term.c
index a2ae8c2..065bce4 100644
--- a/src/term.c
+++ b/src/term.c
@@ -155,12 +155,16 @@ tty_ring_bell (struct frame *f)
 static void
 tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym)
 {
-  Lisp_Object lisp_terminal;
-  Lisp_Object extra_codes;
+  /* Use only accessors like CDR_SAFE and assq_no_quit to avoid any
+     form of quitting or signaling an error, since this function can
+     run as part of the "emergency escape" procedure invoked in the
+     middle of GC, where quitting means crashing (Bug#17406).  */
+  if (! terminal->name)
+    return;
   struct tty_display_info *tty = terminal->display_info.tty;
 
-  XSETTERMINAL (lisp_terminal, terminal);
-  for (extra_codes = Fterminal_parameter (lisp_terminal, sym);
+  for (Lisp_Object extra_codes
+        = CDR_SAFE (assq_no_quit (sym, terminal->param_alist));
        CONSP (extra_codes);
        extra_codes = XCDR (extra_codes))
     {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]