зеркало из https://github.com/github/ruby.git
Fix crash when clearing method cache for builtin method
Builtin methods do not always have their mandatory_only_cme created (it is only created when called with only mandatory parameters), so it could be null. If we try to clear the cme, it will crash because it is null. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
This commit is contained in:
Родитель
b95d7d2099
Коммит
c400165afa
|
@ -209,7 +209,7 @@ clear_method_cache_by_id_in_class(VALUE klass, ID mid)
|
||||||
vm_cme_invalidate((rb_callable_method_entry_t *)cme);
|
vm_cme_invalidate((rb_callable_method_entry_t *)cme);
|
||||||
RB_DEBUG_COUNTER_INC(cc_invalidate_tree_cme);
|
RB_DEBUG_COUNTER_INC(cc_invalidate_tree_cme);
|
||||||
|
|
||||||
if (cme->def->iseq_overload) {
|
if (cme->def->iseq_overload && cme->def->body.iseq.mandatory_only_cme) {
|
||||||
vm_cme_invalidate((rb_callable_method_entry_t *)cme->def->body.iseq.mandatory_only_cme);
|
vm_cme_invalidate((rb_callable_method_entry_t *)cme->def->body.iseq.mandatory_only_cme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче