summaryrefslogtreecommitdiffhomepage
path: root/src/state.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-08-11 22:10:51 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2019-08-11 22:14:56 +0900
commit037638335430de0d35d377af3e393c2aeab9451c (patch)
treea9faaf22c2184d520e45f4799cf8899f8682db3e /src/state.c
parent70b53f91c258e23fc5d68dd8f9c7cf5b8e0290f6 (diff)
downloadmruby-037638335430de0d35d377af3e393c2aeab9451c.tar.gz
mruby-037638335430de0d35d377af3e393c2aeab9451c.zip
Reorder finalization to avoid potential crash; ref #4618
`mrb_gc_destroy` may call other mruby API functions from the finalizers. So call that function first.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/state.c b/src/state.c
index c42df71ba..e5e0161bf 100644
--- a/src/state.c
+++ b/src/state.c
@@ -221,10 +221,10 @@ mrb_close(mrb_state *mrb)
}
/* free */
- mrb_gc_free_gv(mrb);
+ mrb_gc_destroy(mrb, &mrb->gc);
mrb_free_context(mrb, mrb->root_c);
+ mrb_gc_free_gv(mrb);
mrb_free_symtbl(mrb);
- mrb_gc_destroy(mrb, &mrb->gc);
mrb_free(mrb, mrb);
}