1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 00:10:27 +00:00
Fix reference counting when cleaning up unused abstract types
per-thread.
This commit is contained in:
Calvin Rose 2023-08-20 14:53:25 -05:00
parent ca4c1e4259
commit b7f8224588

View File

@ -370,14 +370,15 @@ void janet_sweep() {
if (head->type->gc) { if (head->type->gc) {
janet_assert(!head->type->gc(head->data, head->size), "finalizer failed"); janet_assert(!head->type->gc(head->data, head->size), "finalizer failed");
} }
/* Mark as tombstone in place */
items[i].key = janet_wrap_nil();
items[i].value = janet_wrap_false();
janet_vm.threaded_abstracts.deleted++;
janet_vm.threaded_abstracts.count--;
/* Free memory */ /* Free memory */
janet_free(janet_abstract_head(abst)); janet_free(janet_abstract_head(abst));
} }
/* Mark as tombstone in place */
items[i].key = janet_wrap_nil();
items[i].value = janet_wrap_false();
janet_vm.threaded_abstracts.deleted++;
janet_vm.threaded_abstracts.count--;
} }
/* Reset for next sweep */ /* Reset for next sweep */