From 3dc8cde70078ccb38f5f4b0818ad5eecded01bd5 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 14 Mar 2023 23:18:11 -0400 Subject: 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 ``` --- test/ruby/test_weakmap.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby/test_weakmap.rb') diff --git a/test/ruby/test_weakmap.rb b/test/ruby/test_weakmap.rb index d84eb8241e..9bbe2d6b81 100644 --- a/test/ruby/test_weakmap.rb +++ b/test/ruby/test_weakmap.rb @@ -183,5 +183,15 @@ class TestWeakMap < Test::Unit::TestCase GC.compact @wm[i] = obj 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 -- cgit v1.2.3