aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xdisp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index c03689bf616..f4461c1627a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13648,6 +13648,14 @@ redisplay_internal (void)
13648 enum { MAX_HSCROLL_RETRIES = 16 }; 13648 enum { MAX_HSCROLL_RETRIES = 16 };
13649 int hscroll_retries = 0; 13649 int hscroll_retries = 0;
13650 13650
13651 /* Limit the number of retries for when frame(s) become garbaged as
13652 result of redisplaying them. Some packages set various redisplay
13653 hooks, such as window-scroll-functions, to run Lisp that always
13654 calls APIs which cause the frame's garbaged flag to become set,
13655 so we loop indefinitely. */
13656 enum {MAX_GARBAGED_FRAME_RETRIES = 2 };
13657 int garbaged_frame_retries = 0;
13658
13651 /* True means redisplay has to consider all windows on all 13659 /* True means redisplay has to consider all windows on all
13652 frames. False, only selected_window is considered. */ 13660 frames. False, only selected_window is considered. */
13653 bool consider_all_windows_p; 13661 bool consider_all_windows_p;
@@ -14194,7 +14202,8 @@ redisplay_internal (void)
14194 garbage. We have to start over. These cases 14202 garbage. We have to start over. These cases
14195 should be rare, so going all the way back to the 14203 should be rare, so going all the way back to the
14196 top of redisplay should be good enough. */ 14204 top of redisplay should be good enough. */
14197 if (FRAME_GARBAGED_P (f)) 14205 if (FRAME_GARBAGED_P (f)
14206 && garbaged_frame_retries++ < MAX_GARBAGED_FRAME_RETRIES)
14198 goto retry; 14207 goto retry;
14199 14208
14200#if defined (HAVE_WINDOW_SYSTEM) && !defined (HAVE_NS) 14209#if defined (HAVE_WINDOW_SYSTEM) && !defined (HAVE_NS)