From 265e855ca72bcebfcd8b89d07481199d3b4e2417 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 8 May 2008 06:14:36 +0000 Subject: [PATCH] * array.c (rb_ary_sort_bang): freeze temporary array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ array.c | 3 +++ 2 files changed, 7 insertions(+) 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; }