diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-18 17:59:56 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-18 17:59:56 +0000 |
commit | 61e5cf84fffb7620b849fda4cbba58302b0538ff (patch) | |
tree | a57072fe8899d080d317293f86dc3a06e5bc1058 /vm_method.c | |
parent | f25e99c55f42d23aac050594a482cd2e1807e7ac (diff) |
* 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
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vm_method.c b/vm_method.c index 027042b79c..04b62f2c9d 100644 --- a/vm_method.c +++ b/vm_method.c @@ -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; |