1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_method.c (rb_add_method_def): workarond fix for redefinition

of methods. This is because cfp->me uses the rb_method_entry
  which is freed by redefinition of remove_method. Note that
  reusing may cause another problem when the usage is changed.
  [ruby-core:27320] [ruby-core:29464]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-04-18 17:59:56 +00:00
parent f25e99c55f
commit 61e5cf84ff
2 changed files with 16 additions and 2 deletions

View file

@ -1,3 +1,11 @@
Mon Apr 19 00:27:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
* vm_method.c (rb_add_method_def): workarond fix for redefinition
of methods. This is because cfp->me uses the rb_method_entry
which is freed by redefinition of remove_method. Note that
reusing may cause another problem when the usage is changed.
[ruby-core:27320] [ruby-core:29464]
Sun Apr 18 22:13:21 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (string_content): cond_stack and cmdarg_stack are VALUE.

View file

@ -210,12 +210,18 @@ rb_add_method_def(VALUE klass, ID mid, rb_method_type_t type, rb_method_definiti
rb_id2name(old_def->original_id));
}
}
rb_free_method_entry(old_me);
/* FIXME: this avoid to free methods used in cfp, but reusing may cause
* another problem when the usage is changed.
*/
me = old_me;
}
else {
me = ALLOC(rb_method_entry_t);
}
rb_clear_cache_by_id(mid);
me = ALLOC(rb_method_entry_t);
me->flag = NOEX_WITH_SAFE(noex);
me->called_id = mid;
me->klass = klass;