[bugfix] pic_close broken
This commit is contained in:
parent
68ea22f6eb
commit
a785719ccc
38
src/state.c
38
src/state.c
|
@ -129,37 +129,41 @@ pic_close(pic_state *pic)
|
||||||
{
|
{
|
||||||
xh_iter it;
|
xh_iter it;
|
||||||
|
|
||||||
/* free global stacks */
|
/* invoke exit handlers */
|
||||||
free(pic->stbase);
|
PIC_BLK_EXIT(pic);
|
||||||
free(pic->cibase);
|
|
||||||
free(pic->rescue);
|
|
||||||
free(pic->globals);
|
|
||||||
|
|
||||||
xh_destroy(pic->syms);
|
/* clear out root objects */
|
||||||
xh_destroy(pic->global_tbl);
|
pic->sp = pic->stbase;
|
||||||
|
pic->ci = pic->cibase;
|
||||||
pic->glen = 0;
|
pic->ridx = 0;
|
||||||
pic->rlen = 0;
|
|
||||||
pic->arena_idx = 0;
|
pic->arena_idx = 0;
|
||||||
pic->lib_tbl = pic_undef_value();
|
pic->err = NULL;
|
||||||
|
pic->glen = 0;
|
||||||
xh_clear(pic->macros);
|
xh_clear(pic->macros);
|
||||||
|
pic->lib_tbl = pic_nil_value();
|
||||||
|
|
||||||
/* free all values */
|
/* free all heap objects */
|
||||||
pic_gc_run(pic);
|
pic_gc_run(pic);
|
||||||
|
|
||||||
xh_destroy(pic->macros);
|
|
||||||
|
|
||||||
/* free heaps */
|
/* free heaps */
|
||||||
pic_heap_close(pic->heap);
|
pic_heap_close(pic->heap);
|
||||||
|
|
||||||
|
/* free runtime context */
|
||||||
|
free(pic->stbase);
|
||||||
|
free(pic->cibase);
|
||||||
|
free(pic->rescue);
|
||||||
|
|
||||||
|
/* free global stacks */
|
||||||
|
free(pic->globals);
|
||||||
|
xh_destroy(pic->syms);
|
||||||
|
xh_destroy(pic->global_tbl);
|
||||||
|
xh_destroy(pic->macros);
|
||||||
|
|
||||||
/* free symbol names */
|
/* free symbol names */
|
||||||
for (xh_begin(pic->sym_names, &it); ! xh_isend(&it); xh_next(&it)) {
|
for (xh_begin(pic->sym_names, &it); ! xh_isend(&it); xh_next(&it)) {
|
||||||
free((void *)it.e->val);
|
free((void *)it.e->val);
|
||||||
}
|
}
|
||||||
free(pic->sym_names);
|
free(pic->sym_names);
|
||||||
|
|
||||||
PIC_BLK_DECREF(pic, pic->blk);
|
|
||||||
|
|
||||||
free(pic);
|
free(pic);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue