diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-12-06 22:43:08 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-12-06 22:43:08 +0100 |
commit | dc8027c5894c5b481cec9ca5d24951f753824e20 (patch) | |
tree | 9e5da3535bd6c626853657528b545e60b7cd4bb4 /types.c | |
parent | 3489b7571ee5e0e69f9f5724cd5b3701591353d1 (diff) |
types: consider resource prototypes when marking reachable objects
The prevents garbage collecting properties which are stored in resource
value prototype objects.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'types.c')
-rw-r--r-- | types.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -121,6 +121,7 @@ ucv_gc_mark(uc_value_t *uv) uc_upval_tref_t *upval; uc_object_t *object; uc_array_t *array; + uc_resource_t *resource; struct lh_entry *entry; size_t i; @@ -152,7 +153,6 @@ ucv_gc_mark(uc_value_t *uv) lh_foreach(object->table, entry) ucv_gc_mark((uc_value_t *)lh_entry_v(entry)); - break; case UC_CLOSURE: @@ -174,6 +174,14 @@ ucv_gc_mark(uc_value_t *uv) ucv_gc_mark(upval->value); break; + case UC_RESSOURCE: + resource = (uc_resource_t *)uv; + + if (resource->type) + ucv_gc_mark(resource->type->proto); + + break; + default: break; } |