Fix crash during compaction
[Bug #19529] The fix for [Bug #19529] in commit 548086b contained a bug that crashes on the following script: ``` wm = ObjectSpace::WeakMap.new obj = Object.new 100.times do wm[Object.new] = obj GC.start end GC.compact ```
This commit is contained in:
parent
70ba310212
commit
3dc8cde700
@ -183,5 +183,15 @@ class TestWeakMap < Test::Unit::TestCase
|
|||||||
GC.compact
|
GC.compact
|
||||||
@wm[i] = obj
|
@wm[i] = obj
|
||||||
end
|
end
|
||||||
|
|
||||||
|
assert_separately(%w(--disable-gems), <<-'end;')
|
||||||
|
wm = ObjectSpace::WeakMap.new
|
||||||
|
obj = Object.new
|
||||||
|
100.times do
|
||||||
|
wm[Object.new] = obj
|
||||||
|
GC.start
|
||||||
|
end
|
||||||
|
GC.compact
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -17,7 +17,7 @@ wmap_replace_ref(st_data_t *key, st_data_t *value, st_data_t _argp, int existing
|
|||||||
{
|
{
|
||||||
*key = rb_gc_location((VALUE)*key);
|
*key = rb_gc_location((VALUE)*key);
|
||||||
|
|
||||||
VALUE *values = (VALUE *)value;
|
VALUE *values = (VALUE *)*value;
|
||||||
VALUE size = values[0];
|
VALUE size = values[0];
|
||||||
|
|
||||||
for (VALUE index = 1; index <= size; index++) {
|
for (VALUE index = 1; index <= size; index++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user