From ad0c98b610b56af164e73224abf311141487b65e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 16 Apr 2024 15:12:42 +0300 Subject: [PATCH] Minor fix in detecting recursive redisplay invocations * src/xdisp.c (redisplay_internal): Detect recursive invocations earlier. (Bug#66416) (cherry picked from commit 1be21dd95388037cfb71474a1fbd2a7d3583a80a) --- src/xdisp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index b154211cc3c..f8c8d763c5b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -16863,6 +16863,13 @@ redisplay_internal (void) redisplay_trace ("redisplay_internal %d\n", redisplaying_p); + /* I don't think this happens but let's be paranoid. In particular, + this was observed happening when Emacs shuits down to to losing X + connection, in which case accessing SELECTED_FRAME and the frame + structure is likely to barf. */ + if (redisplaying_p) + return; + /* No redisplay if running in batch mode or frame is not yet fully initialized, or redisplay is explicitly turned off by setting Vinhibit_redisplay. */ @@ -16890,10 +16897,6 @@ redisplay_internal (void) return; #endif - /* I don't think this happens but let's be paranoid. */ - if (redisplaying_p) - return; - /* Record a function that clears redisplaying_p when we leave this function. */ specpdl_ref count = SPECPDL_INDEX (); -- 2.39.5