From ef005bc82a48d8ee0acd073a17c7d3481ecb702e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 12 Jan 2023 12:09:14 -0700 Subject: [PATCH] [subset-input] Fix destruction Ouch! Object was already destroyed at that point before. --- src/hb-subset-input.cc | 8 -------- src/hb-subset-input.hh | 11 +++++++++++ src/hb-subset-plan.hh | 3 --- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index 89f7baac1..1478cd171 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -241,14 +241,6 @@ hb_subset_input_destroy (hb_subset_input_t *input) { if (!hb_object_destroy (input)) return; - for (hb_set_t* set : input->sets_iter ()) - hb_set_destroy (set); - -#ifdef HB_EXPERIMENTAL_API - for (auto _ : input->name_table_overrides) - _.second.fini (); -#endif - hb_free (input); } diff --git a/src/hb-subset-input.hh b/src/hb-subset-input.hh index c5ccc88be..923bf1b4b 100644 --- a/src/hb-subset-input.hh +++ b/src/hb-subset-input.hh @@ -82,6 +82,17 @@ HB_MARK_AS_FLAG_T (hb_subset_flags_t); struct hb_subset_input_t { + ~hb_subset_input_t () + { + for (hb_set_t* set : sets_iter ()) + hb_set_destroy (set); + +#ifdef HB_EXPERIMENTAL_API + for (auto _ : name_table_overrides) + _.second.fini (); +#endif + } + hb_object_header_t header; struct sets_t { diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index 4d0445704..0e4247440 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -43,9 +43,6 @@ struct Feature; struct hb_subset_plan_t { - hb_subset_plan_t () - {} - ~hb_subset_plan_t() { hb_face_destroy (source);