]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix display of compositions when font style changes (Cairo backend)
authorTim Ruffing <dev@real-or-random.org>
Thu, 7 Nov 2024 02:09:09 +0000 (03:09 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 9 Nov 2024 15:47:21 +0000 (16:47 +0100)
* 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)

(cherry picked from commit 9149aa89ee860627cc91e27c8659ad6f4efcfcd8)

src/ftcrfont.c

index 3700154e44ad9699b31a6343aaa55ba363a74bb6..ee111d18763e64ee0fd6d6eb648dcac7be12e149 100644 (file)
@@ -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;
 }