diff --git a/ChangeLog b/ChangeLog index 53d964f96c..a9e5d241ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu May 8 15:14:34 2008 Nobuyoshi Nakada + + * array.c (rb_ary_sort_bang): freeze temporary array. + Thu May 8 13:19:18 2008 Nobuyoshi Nakada * vm.c (rb_thread_mark): mark stat_insn_usage only when ptr is not diff --git a/array.c b/array.c index 9df29447f1..9fe0fc9c1b 100644 --- a/array.c +++ b/array.c @@ -1513,13 +1513,16 @@ rb_ary_sort_bang(VALUE ary) RBASIC(tmp)->klass = 0; ruby_qsort(RARRAY_PTR(tmp), RARRAY_LEN(tmp), sizeof(VALUE), rb_block_given_p()?sort_1:sort_2, &RBASIC(tmp)->klass); + sort_reentered(&RBASIC(tmp)->klass); RARRAY(ary)->ptr = RARRAY(tmp)->ptr; RARRAY(ary)->len = RARRAY(tmp)->len; RARRAY(ary)->aux.capa = RARRAY(tmp)->aux.capa; FL_UNSET(ary, ELTS_SHARED); RARRAY(tmp)->ptr = 0; RARRAY(tmp)->len = 0; + RARRAY(tmp)->aux.capa = 0; RBASIC(tmp)->klass = RBASIC(ary)->klass; + OBJ_FREEZE(tmp); } return ary; }