[前][次][番号順一覧][スレッド一覧]

ruby-changes:35555

From: nobu <ko1@a...>
Date: Fri, 19 Sep 2014 11:41:07 +0900 (JST)
Subject: [ruby-changes:35555] nobu:r47637 (trunk): class.c: do not freeze class of hidden object

nobu	2014-09-19 11:40:58 +0900 (Fri, 19 Sep 2014)

  New Revision: 47637

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47637

  Log:
    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.

  Modified files:
    trunk/class.c
    trunk/include/ruby/ruby.h
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 47636)
+++ include/ruby/ruby.h	(revision 47637)
@@ -1122,7 +1122,7 @@ rb_obj_freeze_inline(VALUE x) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1122
 {
     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);
 	}
     }
Index: class.c
===================================================================
--- class.c	(revision 47636)
+++ class.c	(revision 47637)
@@ -1584,8 +1584,8 @@ rb_freeze_singleton_class(VALUE x) https://github.com/ruby/ruby/blob/trunk/class.c#L1584
     /* 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);
 	}
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]