From b4add2ac2be49677b05402bf236c7e547949e0a8 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 16 Feb 2013 07:41:55 +0000 Subject: * vm.c (rb_thread_mark): mark a working Proc of bmethod (a method defined by define_method) even if the method was removed. We could not trace working Proc object which represents the body of bmethod if the method was removed (alias/undef/overridden). Simply, it was mark miss. This patch by Kazuki Tsujimoto. [Bug #7825] NOTE: We can brush up this marking because we do not need to mark `me' on each living control frame. We need to mark `me's only if `me' was free'ed. This is future work after Ruby 2.0.0. * test/ruby/test_method.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_method.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 59034eb83a..7de4479a2b 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -561,4 +561,18 @@ class TestMethod < Test::Unit::TestCase } assert_equal(c, c.instance_method(:foo).owner, bug7836) end + + def test_gced_bmethod + assert_normal_exit %q{ + require 'irb' + IRB::Irb.module_eval do + define_method(:eval_input) do + IRB::Irb.module_eval { alias_method :eval_input, :to_s } + GC.start + Kernel + end + end + IRB.start + }, '[Bug #7825]' + end end -- cgit v1.2.3