Minor fix in detecting recursive redisplay invocations
authorEli Zaretskii <eliz@gnu.org>
Tue, 16 Apr 2024 12:12:42 +0000 (15:12 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 16 Apr 2024 12:12:42 +0000 (15:12 +0300)
* src/xdisp.c (redisplay_internal): Detect recursive invocations
earlier.  (Bug#66416)

src/xdisp.c

index b154211cc3c483ea03e93bec9f95aaf97ffb14de..f8c8d763c5bbcfc472f7d6057999780e8454fdd0 100644 (file)
@@ -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 ();