all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eric Hoffman <yuri@tenuki.org>
Cc: 17406@debbugs.gnu.org, 28279@debbugs.gnu.org,
	Richard Stallman <rms@gnu.org>
Subject: bug#17406: 25.2; repeatable crash when hitting C-g twice
Date: Sun, 17 Sep 2017 22:10:10 -0700	[thread overview]
Message-ID: <8dd2fcc7-c78f-f313-a9eb-cbe35344fe21@cs.ucla.edu> (raw)
In-Reply-To: <E1WhCsg-0007fm-5E@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

Eli's suggestion looks good. I tweaked his patch slightly to avoid some calls 
and installed the attached into the emacs-26 branch to implement it. Please give 
it a try.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Avoid-crash-with-C-g-C-g-in-GC.patch --]
[-- Type: text/x-patch; name="0001-Avoid-crash-with-C-g-C-g-in-GC.patch", Size: 1499 bytes --]

From e56681085ee0575358b2193d69dd1a3c2ecf3dee Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 17 Sep 2017 22:01:56 -0700
Subject: [PATCH] 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))
     {
-- 
2.7.4


      reply	other threads:[~2017-09-18  5:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-05  7:00 bug#17406: C-g C-g in GC causes crash Richard Stallman
2017-09-18  5:10 ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8dd2fcc7-c78f-f313-a9eb-cbe35344fe21@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=17406@debbugs.gnu.org \
    --cc=28279@debbugs.gnu.org \
    --cc=rms@gnu.org \
    --cc=yuri@tenuki.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.