*fixed a repeated releasing bug when using sub routine.
This commit is contained in:
parent
7f8a18c9b0
commit
d21c797b3f
@ -837,6 +837,7 @@ static _ls_node_t* _search_var_in_scope_chain(mb_interpreter_t* s, _running_cont
|
||||
static int _dispose_object(_object_t* obj);
|
||||
static int _destroy_object(void* data, void* extra);
|
||||
static int _destroy_object_non_syntax(void* data, void* extra);
|
||||
static int _destroy_object_capsule_only(void* data, void* extra);
|
||||
static int _remove_source_object(void* data, void* extra);
|
||||
static int _compare_numbers(const _object_t* first, const _object_t* second);
|
||||
static bool_t _is_internal_object(_object_t* obj);
|
||||
@ -3494,6 +3495,22 @@ _exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
int _destroy_object_capsule_only(void* data, void* extra) {
|
||||
/* Destroy only the capsule (wrapper) of a syntax object */
|
||||
int result = _OP_RESULT_NORMAL;
|
||||
_object_t* obj = 0;
|
||||
mb_unrefvar(extra);
|
||||
|
||||
mb_assert(data);
|
||||
|
||||
obj = (_object_t*)data;
|
||||
safe_free(obj);
|
||||
|
||||
result = _OP_RESULT_DEL_NODE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int _remove_source_object(void* data, void* extra) {
|
||||
/* Remove an object referenced from source code */
|
||||
int result = _OP_RESULT_DEL_NODE;
|
||||
@ -6262,6 +6279,11 @@ int _core_return(mb_interpreter_t* s, void** l) {
|
||||
ast = ast->next;
|
||||
mb_check(mb_pop_value(s, (void**)(&ast), &arg));
|
||||
mb_check(mb_push_value(s, (void**)(&ast), arg));
|
||||
|
||||
if(arg.type == MB_DT_STRING) {
|
||||
_ls_foreach(s->temp_values, _destroy_object_capsule_only);
|
||||
_ls_clear(s->temp_values);
|
||||
}
|
||||
}
|
||||
ast = (_ls_node_t*)_ls_popback(sub_stack);
|
||||
if(!ast) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user