From d9a597408f0f192ff25ab51e1e6733fe6fefc01b Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 19 Sep 2014 01:45:45 +0000 Subject: class.c: do not freeze meta-meta-class * class.c (rb_freeze_singleton_class): should not propagate to meta-meta-class, and so on, which is shared with the original class. fix occational exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/ruby.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 4b57e7848b..f6dfd977eb 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1108,14 +1108,15 @@ struct RStruct { #define OBJ_FREEZE_RAW(x) (RBASIC(x)->flags |= FL_FREEZE) #define OBJ_FREEZE(x) rb_obj_freeze_inline((VALUE)x) +void rb_freeze_singleton_class(VALUE klass); + static inline void rb_obj_freeze_inline(VALUE x) { if (FL_ABLE(x)) { - VALUE klass = RBASIC_CLASS(x); OBJ_FREEZE_RAW(x); - if (FL_TEST(klass, (FL_SINGLETON|FL_FREEZE)) == FL_SINGLETON) { - OBJ_FREEZE_RAW(klass); + if (!(RBASIC(x)->flags & FL_SINGLETON)) { + rb_freeze_singleton_class(x); } } } -- cgit v1.2.3