From 9ea4ab60514d5f22d360a0a199cf8a126adf5e18 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 20 Jul 2022 14:57:32 -0600 Subject: [PATCH] [object] Call constructor --- src/hb-font.cc | 1 + src/hb-map.cc | 2 -- src/hb-map.hh | 2 -- src/hb-object.hh | 3 +++ src/hb-set.cc | 2 -- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/hb-font.cc b/src/hb-font.cc index 0811621d1..4f035c541 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -1675,6 +1675,7 @@ _hb_font_create (hb_face_t *face) if (unlikely (!face)) face = hb_face_get_empty (); + if (!(font = hb_object_create ())) return hb_font_get_empty (); diff --git a/src/hb-map.cc b/src/hb-map.cc index a4b549a45..13089aa04 100644 --- a/src/hb-map.cc +++ b/src/hb-map.cc @@ -56,8 +56,6 @@ hb_map_create () if (!(map = hb_object_create ())) return hb_map_get_empty (); - map->init_shallow (); - return map; } diff --git a/src/hb-map.hh b/src/hb-map.hh index 8ff7b2d7c..6c5d8760b 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -459,8 +459,6 @@ hb_hashmap_t* hb_hashmap_create () if (!(map = hb_object_create ())) return nullptr; - map->init_shallow (); - return map; } diff --git a/src/hb-object.hh b/src/hb-object.hh index 4b5bc32ad..19cdb0451 100644 --- a/src/hb-object.hh +++ b/src/hb-object.hh @@ -222,8 +222,11 @@ static inline Type *hb_object_create () if (unlikely (!obj)) return obj; + new (obj) Type; + hb_object_init (obj); hb_object_trace (obj, HB_FUNC); + return obj; } template diff --git a/src/hb-set.cc b/src/hb-set.cc index b3de01a8b..e74c503c3 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc @@ -56,8 +56,6 @@ hb_set_create () if (!(set = hb_object_create ())) return hb_set_get_empty (); - set->init_shallow (); - return set; }