*fixed a GC bug with upvalues in a closure.

This commit is contained in:
Wang Renxin 2017-11-05 19:23:20 +08:00
parent ef73407de3
commit 20a4ab7c06
2 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,5 @@
Nov. 5 2017
Fixed a GC bug with upvalues in a closure
Fixed a crash bug with conflicting routine and class identifier
Fixed a dangling pointer bug with incomplete structures
Fixed a memory leak with wrong routine or class identifier

View File

@ -6393,8 +6393,12 @@ static int _gc_add_reachable(void* data, void* extra, void* h) {
#ifdef MB_ENABLE_LAMBDA
case _DT_ROUTINE:
if(obj->data.routine->type == MB_RT_LAMBDA) {
if(!_ht_find(ht, &obj->data.routine->func.lambda.ref))
if(!_ht_find(ht, &obj->data.routine->func.lambda.ref)) {
_ht_set_or_insert(ht, &obj->data.routine->func.lambda.ref, obj->data.routine);
if(obj->data.routine->func.lambda.outer_scope) {
_HT_FOREACH(obj->data.routine->func.lambda.outer_scope->scope->var_dict, _do_nothing_on_object, _gc_add_reachable, ht);
}
}
}
break;