From 63c7d9111c29e96c51768a60253ca1132165fd51 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 1 Oct 2015 15:18:42 +0000 Subject: [PATCH] proc.c: fix symbol proc mark * proc.c (proc_mark): block.ep of Proc from Symbol is now NULL. [ruby-core:70961] [Bug #11560] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ proc.c | 4 +++- test/ruby/test_symbol.rb | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8cafa060ed..f161ce010a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Oct 2 00:18:39 2015 Nobuyoshi Nakada + + * proc.c (proc_mark): block.ep of Proc from Symbol is now NULL. + [ruby-core:70961] [Bug #11560] + Wed Sep 30 15:47:13 2015 Nobuyoshi Nakada * vm_args.c (vm_caller_setup_arg_block): bypass Symbol#to_proc diff --git a/proc.c b/proc.c index bd4719d00f..d685fe289d 100644 --- a/proc.c +++ b/proc.c @@ -48,7 +48,9 @@ proc_mark(void *ptr) rb_proc_t *proc = ptr; RUBY_MARK_UNLESS_NULL(proc->block.proc); RUBY_MARK_UNLESS_NULL(proc->block.self); - RUBY_MARK_UNLESS_NULL(rb_vm_proc_envval(proc)); + if (proc->block.ep) { + RUBY_MARK_UNLESS_NULL(rb_vm_proc_envval(proc)); + } if (proc->block.iseq && RUBY_VM_IFUNC_P(proc->block.iseq)) { rb_gc_mark((VALUE)(proc->block.iseq)); } diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index b62e7538c8..bf2c4adbc9 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -122,6 +122,11 @@ class TestSymbol < Test::Unit::TestCase GC.stress = true true.tap(&:itself) end; + + assert_ruby_status([], <<-"end;", timeout: 0.1) + GC.stress = true + 100.times {Proc.new(&:itself)} + end; end def test_call