From 8d62ad3b357e3cc3001bc1af43559affcd099ef6 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 23 Mar 2025 15:27:36 +0200 Subject: [PATCH] =?UTF-8?q?[directwrite]=20Don=E2=80=99t=20release=20IDWri?= =?UTF-8?q?teFace=20pass=20to=20hb=5Fdirectwrite=5Ffont=5Fcreate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That was a leftover from previous code and is incorrect now as we would be double releasing it. --- src/hb-directwrite.cc | 4 +--- test/api/test-directwrite.cc | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc index b891554bc..4c2a8e1d6 100644 --- a/src/hb-directwrite.cc +++ b/src/hb-directwrite.cc @@ -346,7 +346,7 @@ hb_directwrite_font_create (IDWriteFontFace *dw_face) hb_face_destroy (face); if (unlikely (hb_object_is_immutable (font))) - goto done; + return font; /* Copy font variations */ if (SUCCEEDED (dw_face->QueryInterface (__uuidof (IDWriteFontFace5), (void**) &dw_face5))) @@ -378,8 +378,6 @@ hb_directwrite_font_create (IDWriteFontFace *dw_face) dw_face->AddRef (); font->data.directwrite.cmpexch (nullptr, (hb_directwrite_font_data_t *) dw_face); -done: - dw_face->Release (); return font; } diff --git a/test/api/test-directwrite.cc b/test/api/test-directwrite.cc index b89970a79..a9d3a4bb5 100644 --- a/test/api/test-directwrite.cc +++ b/test/api/test-directwrite.cc @@ -45,8 +45,7 @@ get_dwfontface (const char *font_path) dw_font_face->AddRef (); - // Don't destroy face, as dw_font_face is backed by its data I think. - //hb_face_destroy (face); + hb_face_destroy (face); return dw_font_face; } @@ -127,8 +126,7 @@ test_native_directwrite_variations (void) hb_font_destroy (font); - // FIXME: This crashes! - //dw_facevariations->Release (); + dw_facevariations->Release (); }