all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: joaotavora@gmail.com
Cc: 34394@debbugs.gnu.org
Subject: bug#34394: 27.0.50; Emacs segfaults with SLY, company and C-g
Date: Tue, 12 Feb 2019 21:15:20 +0200	[thread overview]
Message-ID: <83bm3gq0mv.fsf@gnu.org> (raw)
In-Reply-To: <83d0nwq2rg.fsf@gnu.org> (message from Eli Zaretskii on Tue, 12 Feb 2019 20:29:23 +0200)

> Date: Tue, 12 Feb 2019 20:29:23 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 34394@debbugs.gnu.org
> 
> > From: João Távora <joaotavora@gmail.com>
> > Date: Tue, 12 Feb 2019 18:10:06 +0000
> > Cc: 34394@debbugs.gnu.org
> > 
> > If it works, can this please make it to Emacs 26.2?
> 
> I hope so.

Actually, please try this simpler patch instead:

diff --git a/src/keyboard.c b/src/keyboard.c
index 49c687f..282eac7 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -364,7 +364,7 @@ static Lisp_Object make_lispy_focus_out (Lisp_Object);
 #endif /* HAVE_WINDOW_SYSTEM */
 static bool help_char_p (Lisp_Object);
 static void save_getcjmp (sys_jmp_buf);
-static void restore_getcjmp (sys_jmp_buf);
+static void restore_getcjmp (void *);
 static Lisp_Object apply_modifiers (int, Lisp_Object);
 static void restore_kboard_configuration (int);
 static void handle_interrupt (bool);
@@ -2144,12 +2144,14 @@ read_event_from_main_queue (struct timespec *end_time,
     return c;
 
   /* Actually read a character, waiting if necessary.  */
+  ptrdiff_t count = SPECPDL_INDEX ();
   save_getcjmp (save_jump);
+  record_unwind_protect_ptr (restore_getcjmp, save_jump);
   restore_getcjmp (local_getcjmp);
   if (!end_time)
     timer_start_idle ();
   c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time);
-  restore_getcjmp (save_jump);
+  unbind_to (count, Qnil);
 
   if (! NILP (c) && (kb != current_kboard))
     {
@@ -2638,10 +2640,12 @@ read_char (int commandflag, Lisp_Object map,
 	{
 	  Lisp_Object tem0;
 
+	  ptrdiff_t count = SPECPDL_INDEX ();
 	  save_getcjmp (save_jump);
+	  record_unwind_protect_ptr (restore_getcjmp, save_jump);
 	  restore_getcjmp (local_getcjmp);
 	  tem0 = sit_for (Vecho_keystrokes, 1, 1);
-	  restore_getcjmp (save_jump);
+	  unbind_to (count, Qnil);
 	  if (EQ (tem0, Qt)
 	      && ! CONSP (Vunread_command_events))
 	    echo_now ();
@@ -2712,10 +2716,12 @@ read_char (int commandflag, Lisp_Object map,
 
 	  timeout = min (timeout, MOST_POSITIVE_FIXNUM / delay_level * 4);
 	  timeout = delay_level * timeout / 4;
+	  ptrdiff_t count1 = SPECPDL_INDEX ();
 	  save_getcjmp (save_jump);
+	  record_unwind_protect_ptr (restore_getcjmp, save_jump);
 	  restore_getcjmp (local_getcjmp);
 	  tem0 = sit_for (make_number (timeout), 1, 1);
-	  restore_getcjmp (save_jump);
+	  unbind_to (count1, Qnil);
 
 	  if (EQ (tem0, Qt)
 	      && ! CONSP (Vunread_command_events))
@@ -3325,7 +3331,7 @@ save_getcjmp (sys_jmp_buf temp)
 }
 
 static void
-restore_getcjmp (sys_jmp_buf temp)
+restore_getcjmp (void *temp)
 {
   memcpy (getcjmp, temp, sizeof getcjmp);
 }





  reply	other threads:[~2019-02-12 19:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09  0:55 bug#34394: 27.0.50; Emacs segfaults with SLY, company and C-g João Távora
2019-02-09  7:59 ` Eli Zaretskii
2019-02-09  9:45   ` João Távora
2019-02-09 10:10     ` Eli Zaretskii
2019-02-09 11:31       ` João Távora
2019-02-09 12:11         ` Eli Zaretskii
2019-02-09 12:33           ` Eli Zaretskii
2019-02-09 12:56             ` João Távora
2019-02-09 13:11               ` Eli Zaretskii
2019-02-09 13:23                 ` João Távora
2019-02-09 13:46                   ` Eli Zaretskii
2019-02-09 14:00                     ` João Távora
2019-02-09 14:01                       ` João Távora
2019-02-09 14:13                         ` João Távora
2019-02-09 14:36                           ` Eli Zaretskii
2019-02-09 15:21                           ` Eli Zaretskii
2019-02-09 15:37                             ` João Távora
2019-02-09 15:51                               ` Eli Zaretskii
2019-02-09 16:04                                 ` João Távora
2019-02-09 16:14                                   ` João Távora
2019-02-09 16:20                                     ` Eli Zaretskii
2019-02-09 16:26                                       ` João Távora
2019-02-09 20:08                                         ` João Távora
2019-02-10 16:42                                           ` Eli Zaretskii
2019-02-12 17:25                                             ` Eli Zaretskii
2019-02-12 18:10                                               ` João Távora
2019-02-12 18:29                                                 ` Eli Zaretskii
2019-02-12 19:15                                                   ` Eli Zaretskii [this message]
2019-02-12 20:42                                                     ` João Távora
2019-02-13 16:26                                                       ` Eli Zaretskii
2019-02-18 20:42                                                         ` João Távora
2019-02-19  3:28                                                           ` Eli Zaretskii
2019-02-09 16:21                                   ` Eli Zaretskii
2019-02-09 14:48                       ` Eli Zaretskii
2019-02-09 11:38       ` João Távora
2019-02-09  8:08 ` Andreas Schwab

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=83bm3gq0mv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=34394@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    /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.