Fix rare segfaults due to freed fontsets

* src/xfaces.c (recompute_basic_faces): Force complete
recalculation of non-ASCII faces and their fontsets if any
non-ASCII faces are in the frame's face cache.  (Bug#72692)
This commit is contained in:
Eli Zaretskii 2024-08-29 12:56:27 +03:00
parent 427fb319da
commit 13f69f254c

View file

@ -733,9 +733,18 @@ recompute_basic_faces (struct frame *f)
{
if (FRAME_FACE_CACHE (f))
{
bool non_basic_faces_cached =
FRAME_FACE_CACHE (f)->used > BASIC_FACE_ID_SENTINEL;
clear_face_cache (false);
if (!realize_basic_faces (f))
emacs_abort ();
/* The call to realize_basic_faces above recomputed the basic
faces and freed their fontsets, but if there are non-ASCII
faces in the cache, they might now be invalid, and they
reference fontsets that are no longer in Vfontset_table. We
therefore must force complete regeneration of all frame faces. */
if (non_basic_faces_cached)
f->face_change = true;
}
}