From 708759324e2314eb912ddb9758cabecd16469ffe Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Fri, 10 Apr 2026 10:10:59 +0000 Subject: [PATCH] Don't accept dead selected_frame in x_connection_closed (bug#80789) * src/xterm.c (x_connection_closed): Try to restore frame if the selected frame is dead. If that fails, abort. --- src/xterm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index d7451b538e3..48fb78a6f63 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -26961,7 +26961,7 @@ For details, see etc/PROBLEMS.\n", /* The initial "daemon" frame is sometimes not selected by `delete_frame' when Emacs is a background daemon. */ - if (NILP (selected_frame)) + if (NILP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame))) x_try_restore_frame (); unblock_input (); @@ -26970,7 +26970,8 @@ For details, see etc/PROBLEMS.\n", terminal caused all frames to vanish. In that case, simply kill Emacs, since the next redisplay will abort as there is no more selected frame. (bug#56528) */ - if (terminal_list == 0 || NILP (selected_frame)) + if (terminal_list == 0 || NILP (selected_frame) + || !FRAME_LIVE_P (XFRAME (selected_frame))) Fkill_emacs (make_fixnum (70), Qnil); totally_unblock_input ();