mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Protected proc objects given by OP_DEF on registers
If a GC occurs in `mrb_calloc()` called by `mt_rehash()` inside `mrb_define_method_raw(), the `proc` may be destroyed.
This commit is contained in:
@@ -3763,6 +3763,7 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
genop_1(s, OP_SCLASS, cursp());
|
||||
push();
|
||||
genop_2(s, OP_METHOD, cursp(), idx);
|
||||
push(); pop();
|
||||
pop();
|
||||
genop_2(s, OP_DEF, cursp(), sym);
|
||||
if (val) push();
|
||||
|
||||
Reference in New Issue
Block a user