[subset] add destructor to subset plan.

This ensures that it's members get destructed before the plan itself is destructed, as hb_object_destroy calls the destructor for plan.
This commit is contained in:
Garret Rieger 2022-08-18 21:05:48 +00:00 committed by Behdad Esfahbod
parent de37b2650d
commit 37d61afd5e
2 changed files with 45 additions and 39 deletions

View File

@ -620,7 +620,7 @@ _normalize_axes_location (hb_face_t *face,
}
if (has_avar)
seg_maps = &StructAfter<OT::SegmentMaps> (*seg_maps);
axis_count++;
}
all_axes_pinned = !axis_not_pinned;
@ -754,44 +754,6 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
{
if (!hb_object_destroy (plan)) return;
hb_set_destroy (plan->unicodes);
hb_set_destroy (plan->name_ids);
hb_set_destroy (plan->name_languages);
hb_set_destroy (plan->layout_features);
hb_set_destroy (plan->layout_scripts);
hb_set_destroy (plan->glyphs_requested);
hb_set_destroy (plan->drop_tables);
hb_set_destroy (plan->no_subset_tables);
hb_face_destroy (plan->source);
hb_face_destroy (plan->dest);
hb_map_destroy (plan->codepoint_to_glyph);
hb_map_destroy (plan->glyph_map);
hb_map_destroy (plan->reverse_glyph_map);
hb_map_destroy (plan->glyph_map_gsub);
hb_set_destroy (plan->_glyphset);
hb_set_destroy (plan->_glyphset_gsub);
hb_set_destroy (plan->_glyphset_mathed);
hb_set_destroy (plan->_glyphset_colred);
hb_map_destroy (plan->gsub_lookups);
hb_map_destroy (plan->gpos_lookups);
hb_map_destroy (plan->gsub_features);
hb_map_destroy (plan->gpos_features);
hb_map_destroy (plan->colrv1_layers);
hb_map_destroy (plan->colr_palettes);
hb_set_destroy (plan->layout_variation_indices);
hb_map_destroy (plan->layout_variation_idx_map);
hb_hashmap_destroy (plan->gsub_langsys);
hb_hashmap_destroy (plan->gpos_langsys);
hb_hashmap_destroy (plan->axes_location);
hb_hashmap_destroy (plan->sanitized_table_cache);
if (plan->user_axes_location)
{
hb_object_destroy (plan->user_axes_location);
hb_free (plan->user_axes_location);
}
hb_free (plan);
}

View File

@ -37,6 +37,50 @@
struct hb_subset_plan_t
{
hb_subset_plan_t ()
{}
~hb_subset_plan_t()
{
hb_set_destroy (unicodes);
hb_set_destroy (name_ids);
hb_set_destroy (name_languages);
hb_set_destroy (layout_features);
hb_set_destroy (layout_scripts);
hb_set_destroy (glyphs_requested);
hb_set_destroy (drop_tables);
hb_set_destroy (no_subset_tables);
hb_face_destroy (source);
hb_face_destroy (dest);
hb_map_destroy (codepoint_to_glyph);
hb_map_destroy (glyph_map);
hb_map_destroy (reverse_glyph_map);
hb_map_destroy (glyph_map_gsub);
hb_set_destroy (_glyphset);
hb_set_destroy (_glyphset_gsub);
hb_set_destroy (_glyphset_mathed);
hb_set_destroy (_glyphset_colred);
hb_map_destroy (gsub_lookups);
hb_map_destroy (gpos_lookups);
hb_map_destroy (gsub_features);
hb_map_destroy (gpos_features);
hb_map_destroy (colrv1_layers);
hb_map_destroy (colr_palettes);
hb_set_destroy (layout_variation_indices);
hb_map_destroy (layout_variation_idx_map);
hb_hashmap_destroy (gsub_langsys);
hb_hashmap_destroy (gpos_langsys);
hb_hashmap_destroy (axes_location);
hb_hashmap_destroy (sanitized_table_cache);
if (user_axes_location)
{
hb_object_destroy (user_axes_location);
hb_free (user_axes_location);
}
}
hb_object_header_t header;
bool successful;