From b52b47453665fbc088dcd570ffb79ac755dfbe8f Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Thu, 7 Nov 2024 03:09:09 +0100 Subject: [PATCH] Fix additional spacing in compositions (Cairo backend) * src/ftcrfont.c (ftcrhbfont_end_hb_font): Don't persist the result of cairo_ft_scaled_font_lock_face in violation of the API contract. (Bug#73752) --- src/ftcrfont.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ftcrfont.c b/src/ftcrfont.c index 3700154e44a..ee111d18763 100644 --- a/src/ftcrfont.c +++ b/src/ftcrfont.c @@ -708,6 +708,13 @@ ftcrhbfont_end_hb_font (struct font *font, hb_font_t *hb_font) struct font_info *ftcrfont_info = (struct font_info *) font; cairo_scaled_font_t *scaled_font = ftcrfont_info->cr_scaled_font; + eassert (hb_font == ftcrfont_info->hb_font); + /* ftcrfont_info->hb_font holds a reference to the FT_Face returned by + cairo_ft_scaled_font_lock_face. Keeping it around after the + matching unlock call would violate the API contract (Bug#73752). */ + hb_font_destroy (ftcrfont_info->hb_font); + ftcrfont_info->hb_font = NULL; + cairo_ft_scaled_font_unlock_face (scaled_font); ftcrfont_info->ft_size = NULL; } -- 2.47.0