Subject: bug#11049: [PATCH] Block input to prevent crash on SIGHUP (bug#11049)

From: Alan Third <[email-masked]>
Date: Sat, 28 May 2016 00:01:38 +0100

* src/emacs.c (Fkill-emacs): Block input while exiting.
---
 src/emacs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/emacs.c b/src/emacs.c
index 3e0cf59..fa678b0 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1941,6 +1941,13 @@ all of which are called before Emacs is actually killed.  */
   x_clipboard_manager_save_all ();
 #endif
 
+#ifdef HAVE_NS
+  /* Crashes trying to process input while quitting. I'm not bothering
+     to unblock input since, well, we're quitting. If an unblock_input
+     is required it will have to go after Fexpand_file_name below. */
+  block_input();
+#ENDIF
+
   shut_down_emacs (0, (STRINGP (arg) && !feof (stdin)) ? arg : Qnil);
 
 #ifdef HAVE_NS
-- 

I believe this fixes the SIGABRT that occurs when Emacs receives a
SIGHUP.

The problem appears to be that OS X likes to send input to Emacs while
it's in the middle of doing things that it really doesn't appreciate
receiving input while doing. Like minimizing, or shutting down.
-- 
Alan Third