mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
should not copy promoted flags.
* include/ruby/ruby.h (rb_clone_setup): should not copy some flags (FL_PROMOTED0|FL_PROMOTED1|FL_FINALIZE). [Bug #13775] * test/ruby/test_object.rb: add a test (note that this test will fail only when RGENGC_CHECK_MODE >= 2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
66cc7e043b
commit
fb29a4dcda
2 changed files with 12 additions and 1 deletions
|
@ -2028,7 +2028,8 @@ rb_special_const_p(VALUE obj)
|
|||
static inline void
|
||||
rb_clone_setup(VALUE clone, VALUE obj)
|
||||
{
|
||||
rb_obj_setup(clone, rb_singleton_class_clone(obj), RBASIC(obj)->flags);
|
||||
rb_obj_setup(clone, rb_singleton_class_clone(obj),
|
||||
RBASIC(obj)->flags & ~(FL_PROMOTED0|FL_PROMOTED1|FL_FINALIZE));
|
||||
rb_singleton_class_attached(RBASIC_CLASS(clone), clone);
|
||||
if (RB_FL_TEST(obj, RUBY_FL_EXIVAR)) rb_copy_generic_ivar(clone, obj);
|
||||
}
|
||||
|
|
|
@ -934,4 +934,14 @@ class TestObject < Test::Unit::TestCase
|
|||
num.times {a.clone.set}
|
||||
end;
|
||||
end
|
||||
|
||||
def test_clone_object_should_not_be_old
|
||||
assert_normal_exit <<-EOS, '[Bug #13775]'
|
||||
b = proc { }
|
||||
10.times do |i|
|
||||
b.clone
|
||||
GC.start
|
||||
end
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue