Subject: bug#26038: 26.0.50; Crash on OS X

From: Alan Third <[email-masked]>
Date: Fri, 10 Mar 2017 14:44:06 +0000

On Thu, Mar 09, 2017 at 10:42:17AM -0700, Ivan Andrus wrote:
> I switched out of Emacs to check my email and when I came back it had
> crashed.  I had been byte-compiling some files and doing random work
> before that, but everything seemed to work okay.  I just built from source
> yesterday so my uptime wasn't very high.

I think this is because of the changes to event handling that I’ve
made recently to solve the concurrency issues. Unfortunately I don’t
know how we could go about debugging it properly since the crash
happens deep inside Cocoa libraries.

I’ve attached a patch which I hope might prevent the crash, though. Can
you give it a go and see if the crash repeats, please?

The alternative is to revert commits a65236214d and 3bd2e9e975, which
should take you back to the previous code.

> I build with a few patches, though only elisp changes with the
> exception of the patch from bug 16579 which should only affect
> proced which I haven't at all in this instance.

According to https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16579
that patch was committed to master some time ago.

Thanks for the report.
-- 
Alan Third
>From 6b4787023b247b68ae0598d03dce50a6fce44ab1 Mon Sep 17 00:00:00 2001
From: Alan Third <[email-masked]>
Date: Fri, 10 Mar 2017 14:21:14 +0000
Subject: [PATCH] Disable SIGIO processing on NS port

* src/conf_post.h: undef USABLE_SIGIO and INTERRUPT_INPUT.
* src/nsterm.m (hold_event, ns_select): Remove unneeded calls to raise
SIGIO.
---
 src/conf_post.h | 6 ++++++
 src/nsterm.m    | 3 ---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/conf_post.h b/src/conf_post.h
index e146b9bbe8..3b6b9aff8d 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -355,3 +355,9 @@ extern int emacs_setenv_TZ (char const *);
 #else
 # define UNINIT /* empty */
 #endif
+
+/* The NS port doesn't use SIGIO for input. */
+#ifdef HAVE_NS
+# undef USABLE_SIGIO
+# undef INTERRUPT_INPUT
+#endif
diff --git a/src/nsterm.m b/src/nsterm.m
index f985786e19..d61d357811 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -454,8 +454,6 @@ - (NSColor *)colorUsingDefaultColorSpace
     }
 
   hold_event_q.q[hold_event_q.nr++] = *event;
-  /* Make sure ns_read_socket is called, i.e. we have input.  */
-  raise (SIGIO);
   send_appdefined = YES;
 }
 
@@ -4120,7 +4118,6 @@ in certain situations (rapid incoming events).
   if (hold_event_q.nr > 0)
     {
       /* We already have events pending. */
-      raise (SIGIO);
       errno = EINTR;
       return -1;
     }
-- 
2.12.0