]> Nishi Git Mirror - gwion.git/commitdiff
:art: use tflag_compound for compound_release
authorfennecdjay <fennecdjay@gmail.com>
Wed, 7 Dec 2022 13:16:52 +0000 (14:16 +0100)
committerfennecdjay <fennecdjay@gmail.com>
Wed, 7 Dec 2022 13:16:52 +0000 (14:16 +0100)
include/object.h

index 6223889b1dbbcca0ee8e17fc2fef6d21319fdc6c..f2157ee5c315418eab728c1c48dabaa107697f75 100644 (file)
@@ -60,13 +60,12 @@ static inline void struct_addref(const Gwion gwion, const Type type,
                                  const m_bit *ptr) {
   for (m_uint i = 0; i < vector_size(&type->info->tuple->types); ++i) {
     const Type t = (Type)vector_at(&type->info->tuple->types, i);
-    if (isa(t, gwion->type[et_object]) > 0) {
-      const M_Object o =
+    if (tflag(t, tflag_compound)) {
+      if (!tflag(t, tflag_struct)) {
+        const M_Object o =
           *(M_Object *)(ptr + vector_at(&type->info->tuple->offset, i));
-      ++o->ref;
-    } else if (tflag(t, tflag_struct)) {
-      struct_addref(
-          gwion, t,
+        if(o) o->ref++;
+      } else struct_addref(gwion, t,
           *(m_bit **)(ptr + vector_at(&type->info->tuple->offset, i)));
     }
   }