From cab47db3cc91ef89e2ab2137838fd35f887e527d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 7 Jun 2024 22:30:41 +0300 Subject: [PATCH] Avoid crashes in half-baked emacsclient frames If a client connection comes in while we handle a Lisp error, the new frame creation could signal an error before the new frame is ready for display. * src/xdisp.c (redisplay_internal): Don't redisplay windows on frames that were not completely set up. (Bug#71224) (cherry picked from commit e99a821f978530b4c397f88de145ff7ba9d31040) --- src/xdisp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 4df76baf92b..0148cd76ada 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -17360,10 +17360,13 @@ redisplay_internal (void) = f->redisplay || !REDISPLAY_SOME_P (); bool f_redisplay_flag = f->redisplay; - /* The X error handler may have deleted that frame - before we went back to retry_frame. This must come + /* The X error handler may have deleted that frame before + we went back to retry_frame. Or this could be a TTY + frame that is not completely made, in which case we + cannot safely redisplay its windows. This must come before any accesses to f->terminal. */ - if (!FRAME_LIVE_P (f)) + if (!FRAME_LIVE_P (f) + || (FRAME_TERMCAP_P (f) && !f->after_make_frame)) continue; /* Mark all the scroll bars to be removed; we'll redeem -- 2.39.5