diff options
| author | Eli Zaretskii | 2020-10-21 18:32:51 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2020-10-21 18:32:51 +0300 |
| commit | e29cace60afdab04ff20c4f4043a3ee64ec9d01d (patch) | |
| tree | d71100737cabd9b3d594d78fc3eeaced68bf274c | |
| parent | 18c0e20bea07cf4591b45800205cf25a927045f6 (diff) | |
| download | emacs-e29cace60afdab04ff20c4f4043a3ee64ec9d01d.tar.gz emacs-e29cace60afdab04ff20c4f4043a3ee64ec9d01d.zip | |
Avoid rare crashes while producing line numbers
* src/xdisp.c (maybe_produce_line_number): Prevent freeing of
realized faces for as long as we are using lnum_face_id and
current_lnum_face_id for producing glyphs. (Bug#44111)
| -rw-r--r-- | src/xdisp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 6c401d0abb9..03dc4bec712 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -22793,6 +22793,10 @@ maybe_produce_line_number (struct it *it) | |||
| 22793 | int lnum_face_id = merge_faces (it->w, Qline_number, 0, DEFAULT_FACE_ID); | 22793 | int lnum_face_id = merge_faces (it->w, Qline_number, 0, DEFAULT_FACE_ID); |
| 22794 | int current_lnum_face_id | 22794 | int current_lnum_face_id |
| 22795 | = merge_faces (it->w, Qline_number_current_line, 0, DEFAULT_FACE_ID); | 22795 | = merge_faces (it->w, Qline_number_current_line, 0, DEFAULT_FACE_ID); |
| 22796 | /* From here onwards, we must prevent freeing realized faces, because | ||
| 22797 | we are using the above 2 face IDs for the glyphs we produce. */ | ||
| 22798 | bool save_free_realized_faces = inhibit_free_realized_faces; | ||
| 22799 | inhibit_free_realized_faces = true; | ||
| 22796 | /* Compute point's line number if needed. */ | 22800 | /* Compute point's line number if needed. */ |
| 22797 | if ((EQ (Vdisplay_line_numbers, Qrelative) | 22801 | if ((EQ (Vdisplay_line_numbers, Qrelative) |
| 22798 | || EQ (Vdisplay_line_numbers, Qvisual) | 22802 | || EQ (Vdisplay_line_numbers, Qvisual) |
| @@ -22922,10 +22926,13 @@ maybe_produce_line_number (struct it *it) | |||
| 22922 | it->lnum_width = 0; | 22926 | it->lnum_width = 0; |
| 22923 | it->lnum_pixel_width = 0; | 22927 | it->lnum_pixel_width = 0; |
| 22924 | bidi_unshelve_cache (itdata, false); | 22928 | bidi_unshelve_cache (itdata, false); |
| 22929 | inhibit_free_realized_faces = save_free_realized_faces; | ||
| 22925 | return; | 22930 | return; |
| 22926 | } | 22931 | } |
| 22927 | } | 22932 | } |
| 22928 | 22933 | ||
| 22934 | inhibit_free_realized_faces = save_free_realized_faces; | ||
| 22935 | |||
| 22929 | /* Record the width in pixels we need for the line number display. */ | 22936 | /* Record the width in pixels we need for the line number display. */ |
| 22930 | it->lnum_pixel_width = tem_it.current_x; | 22937 | it->lnum_pixel_width = tem_it.current_x; |
| 22931 | /* Copy the produced glyphs into IT's glyph_row. */ | 22938 | /* Copy the produced glyphs into IT's glyph_row. */ |