summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-19 02:40:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-19 02:40:58 +0000
commit445086e56b4c847610506cf6bb072ef928329355 (patch)
treeff23da41f34c295900a01b6923f8082beb4b51b2 /class.c
parent431dc5c8b531f4ab67d70ea899f9837d2b10e840 (diff)
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
Diffstat (limited to 'class.c')
-rw-r--r--class.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/class.c b/class.c
index 45e27d8..43123f1 100644
--- a/class.c
+++ b/class.c
@@ -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);
}
}