From 75e7f2ff2d23c8a148558c71c88157635ba3fda3 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 12 Jan 2014 14:23:53 +0000 Subject: merge revision(s) 44260: [Backport #9168] patch inspired from r44260 on trunk. [ruby-core:58652] [Bug #9168] * gc.c (run_finalizer): clear th->errinfo before invoke finalizer and restore afterward. * test/ruby/test_gc.rb (test_exception_in_finalizer): add test for above. * vm_trace.c (rb_threadptr_exec_event_hooks_orig): clear th->errinfo before invoke hook. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_gc.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index c678c3c6c6..b7de62b195 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -174,4 +174,17 @@ class TestGc < Test::Unit::TestCase end; end end + + def test_exception_in_finalizer + bug9168 = '[ruby-core:58652] [Bug #9168]' + assert_normal_exit(<<-'end;', bug9168) + raise_proc = proc {raise} + 10000.times do + ObjectSpace.define_finalizer(Object.new, raise_proc) + Thread.handle_interrupt(RuntimeError => :immediate) {break} + Thread.handle_interrupt(RuntimeError => :on_blocking) {break} + Thread.handle_interrupt(RuntimeError => :never) {break} + end + end; + end end -- cgit v1.2.3