Add missing write barrier in set_i_initialize_copy
When we copy the table from one set to another we need to run write barriers.
This commit is contained in:
parent
4b80f56f60
commit
c962735fe8
Notes:
git
2025-06-09 17:07:00 +00:00
1
set.c
1
set.c
@ -528,6 +528,7 @@ set_i_initialize_copy(VALUE set, VALUE other)
|
||||
|
||||
set_free_embedded(sobj);
|
||||
set_copy(&sobj->table, RSET_TABLE(other));
|
||||
rb_gc_writebarrier_remember(set);
|
||||
|
||||
return set;
|
||||
}
|
||||
|
@ -129,6 +129,12 @@ class TC_Set < Test::Unit::TestCase
|
||||
assert_same(set, ret)
|
||||
assert_equal(Set['a','b','c'], set)
|
||||
|
||||
set = Set[1,2]
|
||||
ret = set.replace(Set.new('a'..'c'))
|
||||
|
||||
assert_same(set, ret)
|
||||
assert_equal(Set['a','b','c'], set)
|
||||
|
||||
set = Set[1,2]
|
||||
assert_raise(ArgumentError) {
|
||||
set.replace(3)
|
||||
|
Loading…
x
Reference in New Issue
Block a user