aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2024-05-26 19:41:30 +0300
committerEli Zaretskii2024-05-26 19:41:30 +0300
commit74b8043e60dde6710d0ba413278c2cb36a84f8f2 (patch)
treeaa884615cd22017c05e1b66015fcf67ebfb8223f
parentc593441ab009fb7068f055cda0af1f9fafd2f600 (diff)
downloademacs-74b8043e60dde6710d0ba413278c2cb36a84f8f2.tar.gz
emacs-74b8043e60dde6710d0ba413278c2cb36a84f8f2.zip
Prevent crashes due to redisplay while realizing the default face
* src/xfaces.c (Finternal_merge_in_global_face) (realize_default_face): Prevent redisplay while the default face is being realized. (Bug#71176)
-rw-r--r--src/xdisp.c6
-rw-r--r--src/xfaces.c14
2 files changed, 18 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 7a00b297d61..47675fcc80a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13377,8 +13377,10 @@ echo_area_display (bool update_frame_p)
13377 w = XWINDOW (mini_window); 13377 w = XWINDOW (mini_window);
13378 f = XFRAME (WINDOW_FRAME (w)); 13378 f = XFRAME (WINDOW_FRAME (w));
13379 13379
13380 /* Don't display if frame is invisible or not yet initialized. */ 13380 /* Don't display if frame is invisible or not yet initialized or
13381 if (!FRAME_REDISPLAY_P (f) || !f->glyphs_initialized_p) 13381 if redisplay is inhibited. */
13382 if (!FRAME_REDISPLAY_P (f) || !f->glyphs_initialized_p
13383 || !NILP (Vinhibit_redisplay))
13382 return; 13384 return;
13383 13385
13384#ifdef HAVE_WINDOW_SYSTEM 13386#ifdef HAVE_WINDOW_SYSTEM
diff --git a/src/xfaces.c b/src/xfaces.c
index 5192b22ce0a..258fbc52e64 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -4246,6 +4246,12 @@ Default face attributes override any local face attributes. */)
4246 /* This can be NULL (e.g., in batch mode). */ 4246 /* This can be NULL (e.g., in batch mode). */
4247 if (oldface) 4247 if (oldface)
4248 { 4248 {
4249 /* In some cases, realize_face below can call Lisp, which could
4250 trigger redisplay. But we are in the process of realizing
4251 the default face, and therefore are not ready to do display. */
4252 specpdl_ref count = SPECPDL_INDEX ();
4253 specbind (Qinhibit_redisplay, Qt);
4254
4249 /* Ensure that the face vector is fully specified by merging 4255 /* Ensure that the face vector is fully specified by merging
4250 the previously-cached vector. */ 4256 the previously-cached vector. */
4251 memcpy (attrs, oldface->lface, sizeof attrs); 4257 memcpy (attrs, oldface->lface, sizeof attrs);
@@ -4291,6 +4297,8 @@ Default face attributes override any local face attributes. */)
4291 gvec[LFACE_BACKGROUND_INDEX]); 4297 gvec[LFACE_BACKGROUND_INDEX]);
4292 Fmodify_frame_parameters (frame, arg); 4298 Fmodify_frame_parameters (frame, arg);
4293 } 4299 }
4300
4301 unbind_to (count, Qnil);
4294 } 4302 }
4295 } 4303 }
4296 4304
@@ -5959,7 +5967,13 @@ realize_default_face (struct frame *f)
5959 eassert (lface_fully_specified_p (XVECTOR (lface)->contents)); 5967 eassert (lface_fully_specified_p (XVECTOR (lface)->contents));
5960 check_lface (lface); 5968 check_lface (lface);
5961 memcpy (attrs, xvector_contents (lface), sizeof attrs); 5969 memcpy (attrs, xvector_contents (lface), sizeof attrs);
5970 /* In some cases, realize_face below can call Lisp, which could
5971 trigger redisplay. But we are in the process of realizing
5972 the default face, and therefore are not ready to do display. */
5973 specpdl_ref count = SPECPDL_INDEX ();
5974 specbind (Qinhibit_redisplay, Qt);
5962 struct face *face = realize_face (c, attrs, DEFAULT_FACE_ID); 5975 struct face *face = realize_face (c, attrs, DEFAULT_FACE_ID);
5976 unbind_to (count, Qnil);
5963 5977
5964#ifndef HAVE_WINDOW_SYSTEM 5978#ifndef HAVE_WINDOW_SYSTEM
5965 (void) face; 5979 (void) face;