[object] Call destructor in hb_object_destroy()

This commit is contained in:
Behdad Esfahbod 2022-07-20 15:03:20 -06:00
parent 9ea4ab6051
commit e1b5f2f806
6 changed files with 5 additions and 12 deletions

View File

@ -105,8 +105,6 @@ hb_map_destroy (hb_map_t *map)
{
if (!hb_object_destroy (map)) return;
map->fini_shallow ();
hb_free (map);
}

View File

@ -468,7 +468,7 @@ void hb_hashmap_destroy (hb_hashmap_t<K, V>* map)
{
if (!hb_object_destroy (map))
return;
map->fini_shallow ();
hb_free (map);
}

View File

@ -272,6 +272,9 @@ static inline bool hb_object_destroy (Type *obj)
return false;
hb_object_fini (obj);
obj->~Type ();
return true;
}
template <typename Type>
@ -283,7 +286,7 @@ static inline void hb_object_fini (Type *obj)
{
user_data->fini ();
hb_free (user_data);
user_data = nullptr;
obj->header.user_data.set_relaxed (nullptr);
}
}
template <typename Type>

View File

@ -105,8 +105,6 @@ hb_set_destroy (hb_set_t *set)
{
if (!hb_object_destroy (set)) return;
set->fini_shallow ();
hb_free (set);
}

View File

@ -318,10 +318,6 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan)
{
if (!hb_object_destroy (shape_plan)) return;
#ifndef HB_NO_OT_SHAPE
shape_plan->ot.fini ();
#endif
shape_plan->key.fini ();
hb_free (shape_plan);
}

View File

@ -761,7 +761,6 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
if (!hb_object_destroy (plan)) return;
hb_set_destroy (plan->unicodes);
plan->unicode_to_new_gid_list.fini ();
hb_set_destroy (plan->name_ids);
hb_set_destroy (plan->name_languages);
hb_set_destroy (plan->layout_features);
@ -796,7 +795,6 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
if (plan->user_axes_location)
{
hb_object_destroy (plan->user_axes_location);
plan->user_axes_location->fini_shallow ();
hb_free (plan->user_axes_location);
}