From: Jérémie Astor Date: Mon, 2 Dec 2019 22:53:05 +0000 (+0100) Subject: :art: Improve fork_cleaning X-Git-Tag: nightly~2070^2~10 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=0e557f48283026145e939683b576fe6c4fa0d6dd;p=gwion.git :art: Improve fork_cleaning --- diff --git a/src/lib/shred.c b/src/lib/shred.c index a139a6e3..c1f3cfd9 100644 --- a/src/lib/shred.c +++ b/src/lib/shred.c @@ -149,7 +149,8 @@ static DTOR(fork_dtor) { THREAD_JOIN(FORK_THREAD(o)); const VM *vm = ME(o)->info->vm->parent; if(*(m_int*)(o->data + o_fork_done)) { - vector_rem2(&vm->gwion->data->child, (vtype)o); + const m_int idx = vector_find(&vm->gwion->data->child, (vtype)o); + VPTR(&vm->gwion->data->child, idx) = 0; if(!vm->gwion->data->child2.ptr) vector_init(&vm->gwion->data->child2); vector_add(&vm->gwion->data->child2, (vtype)ME(o)->info->vm->gwion); @@ -222,6 +223,8 @@ ANN void fork_launch(const VM* vm, const M_Object o, const m_uint sz) { ANN void fork_clean(const VM_Shred shred, const Vector v) { for(m_uint i = 0; i < vector_size(v); ++i) { const M_Object o = (M_Object)vector_at(v, i); + if(!o) + continue; THREAD_JOIN(FORK_THREAD(o)); release(o, shred); }