mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* class.c (clone_method): add GC guard to prevent intermediate
variable from GC. [Bug #4321] [ruby-dev:43107] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
de4c25a001
commit
c8e5ba0e84
2 changed files with 8 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Jan 26 22:57:30 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
|
||||||
|
|
||||||
|
* class.c (clone_method): add GC guard to prevent intermediate
|
||||||
|
variable from GC. [Bug #4321] [ruby-dev:43107]
|
||||||
|
|
||||||
Wed Jan 26 22:45:16 2011 Tanaka Akira <akr@fsij.org>
|
Wed Jan 26 22:45:16 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* template/id.h.tmpl: parenthesize macro arguments.
|
* template/id.h.tmpl: parenthesize macro arguments.
|
||||||
|
|
4
class.c
4
class.c
|
@ -129,11 +129,13 @@ VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
|
||||||
static int
|
static int
|
||||||
clone_method(ID mid, const rb_method_entry_t *me, struct clone_method_data *data)
|
clone_method(ID mid, const rb_method_entry_t *me, struct clone_method_data *data)
|
||||||
{
|
{
|
||||||
|
VALUE newiseqval;
|
||||||
if (me->def && me->def->type == VM_METHOD_TYPE_ISEQ) {
|
if (me->def && me->def->type == VM_METHOD_TYPE_ISEQ) {
|
||||||
VALUE newiseqval = rb_iseq_clone(me->def->body.iseq->self, data->klass);
|
|
||||||
rb_iseq_t *iseq;
|
rb_iseq_t *iseq;
|
||||||
|
newiseqval = rb_iseq_clone(me->def->body.iseq->self, data->klass);
|
||||||
GetISeqPtr(newiseqval, iseq);
|
GetISeqPtr(newiseqval, iseq);
|
||||||
rb_add_method(data->klass, mid, VM_METHOD_TYPE_ISEQ, iseq, me->flag);
|
rb_add_method(data->klass, mid, VM_METHOD_TYPE_ISEQ, iseq, me->flag);
|
||||||
|
RB_GC_GUARD(newiseqval);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_method_entry_set(data->klass, mid, me, me->flag);
|
rb_method_entry_set(data->klass, mid, me, me->flag);
|
||||||
|
|
Loading…
Reference in a new issue