* vm.c (vm_define_method): guard iseq from GC while method definition.
[ruby-dev:42832] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
962b75384e
commit
af8df10d3b
@ -1,3 +1,8 @@
|
|||||||
|
Thu Dec 30 23:09:47 2010 wanabe <s.wanabe@gmail.com>
|
||||||
|
|
||||||
|
* vm.c (vm_define_method): guard iseq from GC while method definition.
|
||||||
|
[ruby-dev:42832]
|
||||||
|
|
||||||
Thu Dec 30 20:18:32 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Thu Dec 30 20:18:32 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* win32/Makefile.sub: ditto.
|
* win32/Makefile.sub: ditto.
|
||||||
|
@ -63,4 +63,19 @@ class TestGc < Test::Unit::TestCase
|
|||||||
assert_equal(false, res.empty?)
|
assert_equal(false, res.empty?)
|
||||||
assert_kind_of(Integer, res[:count])
|
assert_kind_of(Integer, res[:count])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_singleton_method
|
||||||
|
prev_stress = GC.stress
|
||||||
|
assert_nothing_raised("[ruby-dev:42832]") do
|
||||||
|
GC.stress = true
|
||||||
|
10.times do
|
||||||
|
obj = Object.new
|
||||||
|
def obj.foo() end
|
||||||
|
def obj.bar() raise "obj.foo is called, but this is obj.bar" end
|
||||||
|
obj.foo
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
GC.stress = prev_stress
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
5
vm.c
5
vm.c
@ -1837,8 +1837,9 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
|
|||||||
GetISeqPtr(iseqval, miseq);
|
GetISeqPtr(iseqval, miseq);
|
||||||
|
|
||||||
if (miseq->klass) {
|
if (miseq->klass) {
|
||||||
iseqval = rb_iseq_clone(iseqval, 0);
|
iseqval = rb_iseq_clone(iseqval, 0);
|
||||||
GetISeqPtr(iseqval, miseq);
|
RB_GC_GUARD(iseqval);
|
||||||
|
GetISeqPtr(iseqval, miseq);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NIL_P(klass)) {
|
if (NIL_P(klass)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user