Subject: bug#60220: 29.0.60; macOS 13.1 crash shortly after starting Emacs

From: Paul Eggert <[email-masked]>
Date: Thu, 22 Dec 2022 18:05:55 -0800

On 12/22/22 00:18, Eli Zaretskii wrote:
> Paul, could you perhaps audit the code which implements restart-emacs,
> and see if we need to make it safer, in particular wrt signals and
> *.eln files loaded via dynlib.

I don't offhand see why anything would need to be done other than turn 
off timer signals to the execed process. Something like the attached 
patch, perhaps. Aaron, could you give it a try?
From 175a4a27dcb17a80d9e8e82344ad3bef47822350 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Thu, 22 Dec 2022 18:01:08 -0800
Subject: [PATCH] Fix restart-emacs alarms (Bug#60220).
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* src/emacs.c (Fkill_emacs): Turn timers off before execing,
so that the re-execed Emacs doesn’t get a timer alarm.
---
 src/emacs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/emacs.c b/src/emacs.c
index d8a2863fd9..a2ba4b50f0 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2910,6 +2910,7 @@ DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 2, "P",
 
   if (!NILP (restart))
     {
+      turn_on_atimers (false);
 #ifdef WINDOWSNT
       if (w32_reexec_emacs (initial_cmdline, initial_wd) < 0)
 #else
-- 
2.38.1