1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

update Array's length correctly.

ARRAY_ASET() does not change the length of array, so
use rb_ary_push() instead of ARRAY_ASET(). It prevents
updating reference on GC.compact.
This commit is contained in:
Koichi Sasada 2019-05-23 11:19:23 +09:00
parent bb29ed6e33
commit 0eff21af8d

View file

@ -902,8 +902,8 @@ vm_caller_setup_arg_block(const rb_execution_context_t *ec, rb_control_frame_t *
if (NIL_P(func)) {
/* TODO: limit cached funcs */
VALUE callback_arg = rb_ary_tmp_new(2);
RARRAY_ASET(callback_arg, 0, block_code);
RARRAY_ASET(callback_arg, 1, ref);
rb_ary_push(callback_arg, block_code);
rb_ary_push(callback_arg, ref);
OBJ_FREEZE_RAW(callback_arg);
func = rb_func_proc_new(refine_sym_proc_call, callback_arg);
rb_hash_aset(ref, block_code, func);