all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: 11049@debbugs.gnu.org
Subject: bug#11049: [PATCH] Prevent NS event loop being re-entered (bug#11049)
Date: Sun, 26 Jun 2016 01:42:59 +0100	[thread overview]
Message-ID: <20160626004259.GA51923@breton.holly.idiocy.org> (raw)
In-Reply-To: <20160528140011.GA22831@breton.holly.idiocy.org>

* nsterm.m (ns_read_socket, ns_select): Return -1 if already in event
loop instead of aborting.
---
 src/nsterm.m | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/nsterm.m b/src/nsterm.m
index eba75f1..60c0da8 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4094,6 +4094,9 @@ in certain situations (rapid incoming events).
 
   NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_read_socket");
 
+  if (apploopnr > 0)
+    return -1; /* Already within event loop. */
+
 #ifdef HAVE_NATIVE_FS
   check_native_fs ();
 #endif
@@ -4178,6 +4181,9 @@ in certain situations (rapid incoming events).
 
   NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select");
 
+  if (apploopnr > 0)
+    return -1; /* Already within event loop. */
+
 #ifdef HAVE_NATIVE_FS
   check_native_fs ();
 #endif
-- 
I'm happier with this one. There's already a mechanism available to
say that we can't process input just now, just return -1. This seems
neater than sending SIGABRT. I thought I could perhaps lose the
emacs_abort further down in both functions, but presumably the
function can be pre-empted between the check and ++apploopnr, which
could be a problem, so I just left it in.

-- 
Alan Third





  reply	other threads:[~2016-06-26  0:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20  8:42 bug#11049: 24.0.93; SIGABRT when closing terminal, emacs running in TTY mode Rotem
2016-05-27 23:01 ` bug#11049: [PATCH] Block input to prevent crash on SIGHUP (bug#11049) Alan Third
2016-05-28 14:00   ` bug#11049: [PATCH v2] " Alan Third
2016-06-26  0:42     ` Alan Third [this message]
2016-07-07 19:54       ` bug#11049: [PATCH] Prevent NS event loop being re-entered (bug#11049) Alan Third

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=20160626004259.GA51923@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=11049@debbugs.gnu.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.