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

class.c: do not freeze class of hidden object

* class.c (rb_freeze_singleton_class): get rid of freeze class of
  hidden object to fix segfaults.

* include/ruby/ruby.h (rb_obj_freeze_inline): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-09-19 02:40:58 +00:00
parent 431dc5c8b5
commit 445086e56b
2 changed files with 3 additions and 3 deletions

View file

@ -1584,8 +1584,8 @@ rb_freeze_singleton_class(VALUE x)
/* should not propagate to meta-meta-class, and so on */
if (!(RBASIC(x)->flags & FL_SINGLETON)) {
VALUE klass = RBASIC_CLASS(x);
klass = RCLASS_ORIGIN(klass);
if (FL_TEST(klass, (FL_SINGLETON|FL_FREEZE)) == FL_SINGLETON) {
if (klass && (klass = RCLASS_ORIGIN(klass)) != 0 &&
FL_TEST(klass, (FL_SINGLETON|FL_FREEZE)) == FL_SINGLETON) {
OBJ_FREEZE_RAW(klass);
}
}

View file

@ -1122,7 +1122,7 @@ rb_obj_freeze_inline(VALUE x)
{
if (FL_ABLE(x)) {
OBJ_FREEZE_RAW(x);
if (!(RBASIC(x)->flags & FL_SINGLETON)) {
if (RBASIC_CLASS(x) && !(RBASIC(x)->flags & FL_SINGLETON)) {
rb_freeze_singleton_class(x);
}
}