From: Eli Zaretskii Date: Sun, 7 Mar 2021 14:31:35 +0000 (+0200) Subject: Avoid aborts in native-comp subprocesses when exiting Emacs on Windows X-Git-Tag: emacs-28.0.90~2727^2~91 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=948e6609b11b0203d6e1d0fdfdcc23b8538f3e98;p=emacs.git Avoid aborts in native-comp subprocesses when exiting Emacs on Windows * 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. --- diff --git a/src/w32.c b/src/w32.c index 7ce907d0adb..14b8b11da00 100644 --- 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); }