From: Eli Zaretskii Date: Tue, 16 Apr 2024 12:12:42 +0000 (+0300) Subject: Minor fix in detecting recursive redisplay invocations X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ad0c98b610b56af164e73224abf311141487b65e;p=emacs.git Minor fix in detecting recursive redisplay invocations * src/xdisp.c (redisplay_internal): Detect recursive invocations earlier. (Bug#66416) (cherry picked from commit 1be21dd95388037cfb71474a1fbd2a7d3583a80a) --- 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 ();