diff options
| author | Eli Zaretskii | 2024-08-29 12:56:27 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-08-29 12:56:27 +0300 |
| commit | 13f69f254cfacfcc780b49c34e044b39dc333732 (patch) | |
| tree | 5cd6baf9c0b18281c6aef06d25c64e804673c5f4 /src | |
| parent | 427fb319dabf2b7fa4526f244d1e8d57f9e6cca0 (diff) | |
| download | emacs-13f69f254cfacfcc780b49c34e044b39dc333732.tar.gz emacs-13f69f254cfacfcc780b49c34e044b39dc333732.zip | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index 684b6ccfac7..bbc3448e457 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -733,9 +733,18 @@ recompute_basic_faces (struct frame *f) | |||
| 733 | { | 733 | { |
| 734 | if (FRAME_FACE_CACHE (f)) | 734 | if (FRAME_FACE_CACHE (f)) |
| 735 | { | 735 | { |
| 736 | bool non_basic_faces_cached = | ||
| 737 | FRAME_FACE_CACHE (f)->used > BASIC_FACE_ID_SENTINEL; | ||
| 736 | clear_face_cache (false); | 738 | clear_face_cache (false); |
| 737 | if (!realize_basic_faces (f)) | 739 | if (!realize_basic_faces (f)) |
| 738 | emacs_abort (); | 740 | emacs_abort (); |
| 741 | /* The call to realize_basic_faces above recomputed the basic | ||
| 742 | faces and freed their fontsets, but if there are non-ASCII | ||
| 743 | faces in the cache, they might now be invalid, and they | ||
| 744 | reference fontsets that are no longer in Vfontset_table. We | ||
| 745 | therefore must force complete regeneration of all frame faces. */ | ||
| 746 | if (non_basic_faces_cached) | ||
| 747 | f->face_change = true; | ||
| 739 | } | 748 | } |
| 740 | } | 749 | } |
| 741 | 750 | ||