]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid aborts in native-comp subprocesses when exiting Emacs on Windows
authorEli Zaretskii <eliz@gnu.org>
Sun, 7 Mar 2021 14:31:35 +0000 (16:31 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sun, 7 Mar 2021 14:31:35 +0000 (16:31 +0200)
* src/w32.c (shutdown_handler): Clear the message stack when being
shut down in noninteractive mode, to avoid aborting in
shut_down_emacs when a native-compilation subprocess is killed
because the parent Emacs exits.

src/w32.c

index 7ce907d0adb481114aa630ef52e85f63daa2c7f3..14b8b11da009c32294267de305d5cf03301d766a 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -10447,6 +10447,13 @@ shutdown_handler (DWORD type)
       || type == CTRL_LOGOFF_EVENT    /* User logs off.  */
       || type == CTRL_SHUTDOWN_EVENT) /* User shutsdown.  */
     {
+      /* If we are being shut down in noninteractive mode, we don't
+        care about the message stack, so clear it to avoid abort in
+        shut_down_emacs.  This happens when an noninteractive Emacs
+        is invoked as a subprocess of Emacs, and the parent wants to
+        kill us, e.g. because it's about to exit.  */
+      if (noninteractive)
+       clear_message_stack ();
       /* Shut down cleanly, making sure autosave files are up to date.  */
       shut_down_emacs (0, Qnil);
     }