From 207fc925023a66478235c4f66b3ef36efd5f5b91 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sun, 14 Aug 2022 20:56:10 +0200 Subject: [PATCH] :art: improve nspc cleaning --- src/env/nspc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/env/nspc.c b/src/env/nspc.c index ff9a00f5..a00c6272 100644 --- a/src/env/nspc.c +++ b/src/env/nspc.c @@ -48,10 +48,11 @@ ANN static void free_nspc_value(const Nspc a, Gwion gwion) { struct scope_iter iter = {a->info->value, 0, 0}; Value v; while (scope_iter(&iter, &v) > 0) { - if (isa(v->type, gwion->type[et_object]) > 0) - nspc_release_object(a, v, gwion); - else if (tflag(v->type, tflag_struct)) - nspc_release_struct(a, v, gwion); + if (tflag(v->type, tflag_cdef)) { + if (!tflag(v->type, tflag_struct)) + nspc_release_object(a, v, gwion); + else nspc_release_struct(a, v, gwion); + } value_remref(v, gwion); } free_scope(gwion->mp, a->info->value); -- 2.43.0