From de37b2650db78c795d1c8049f41444a591ffdf42 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 18 Aug 2022 15:21:48 -0600 Subject: [PATCH] [object] Only destruct object if it's not trivially-destructible Such that we're legally free to access the object to destruct its (pointer) fields ourselves afterwards. For things like hb_font_t, hb_face_t, etc. --- src/hb-object.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-object.hh b/src/hb-object.hh index 8cbf7a8a9..bc37cc5ae 100644 --- a/src/hb-object.hh +++ b/src/hb-object.hh @@ -273,7 +273,8 @@ static inline bool hb_object_destroy (Type *obj) hb_object_fini (obj); - obj->~Type (); + if (!std::is_trivially_destructible::value) + obj->~Type (); return true; }