summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-12 03:03:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-12 03:03:46 +0000
commitda786437a7be37f8807410a82071ace6089df97e (patch)
tree8302a6374caa4db335428cef5492e8f3f584d0e8 /array.c
parentff7bb4723b88ce6461ef6276a441fae4c69bd71d (diff)
array.c: freeze in callback
* array.c (rb_ary_sort_bang): must not be modified once frozen even in a callback method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/array.c b/array.c
index 400403e..9bdbe78 100644
--- a/array.c
+++ b/array.c
@@ -2321,6 +2321,7 @@ rb_ary_sort_bang(VALUE ary)
ruby_qsort(RARRAY_PTR(tmp), len, sizeof(VALUE),
rb_block_given_p()?sort_1:sort_2, &data);
+ rb_ary_modify(ary);
if (ARY_EMBED_P(tmp)) {
assert(ARY_EMBED_P(tmp));
if (ARY_SHARED_P(ary)) { /* ary might be destructively operated in the given block */