Author: zoltan
Date: 2005-10-05 08:55:12 -0400 (Wed, 05 Oct 2005)
New Revision: 51263

Modified:
   branches/mono-1-1-9/mono/mono/metadata/ChangeLog
   branches/mono-1-1-9/mono/mono/metadata/class.c
Log:
Merge from HEAD.


Modified: branches/mono-1-1-9/mono/mono/metadata/ChangeLog
===================================================================
--- branches/mono-1-1-9/mono/mono/metadata/ChangeLog    2005-10-05 12:48:32 UTC 
(rev 51262)
+++ branches/mono-1-1-9/mono/mono/metadata/ChangeLog    2005-10-05 12:55:12 UTC 
(rev 51263)
@@ -1,3 +1,9 @@
+2005-10-05  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * class.c (mono_class_layout_fields): Fix computation of 
+       klass->has_references if a field has a struct type whose has_references
+       field is not yet initialized. Fixes #76331.
+
 2005-09-20 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * socket-io.c: the field names were changed 3 months ago and no one

Modified: branches/mono-1-1-9/mono/mono/metadata/class.c
===================================================================
--- branches/mono-1-1-9/mono/mono/metadata/class.c      2005-10-05 12:48:32 UTC 
(rev 51262)
+++ branches/mono-1-1-9/mono/mono/metadata/class.c      2005-10-05 12:55:12 UTC 
(rev 51263)
@@ -790,6 +790,20 @@
        mono_class_layout_fields (class);
 }
 
+/*
+ * mono_class_has_references:
+ *
+ *   Returns whenever @klass->has_references is set, initializing it if needed.
+ * Assumes the loader lock is held.
+ */
+static gboolean
+mono_class_has_references (MonoClass *klass)
+{
+       mono_class_setup_fields (klass);
+
+       return klass->has_references;
+}
+
 /* useful until we keep track of gc-references in corlib etc. */
 #define IS_GC_REFERENCE(t) ((t)->type == MONO_TYPE_U || (t)->type == 
MONO_TYPE_I || (t)->type == MONO_TYPE_PTR)
 
@@ -832,7 +846,7 @@
                field = &class->fields [i];
 
                ftype = mono_type_get_underlying_type (field->type);
-               if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (ftype) 
|| ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_from_mono_type 
(ftype)->has_references))) {
+               if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (ftype) 
|| ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references 
(mono_class_from_mono_type (ftype))))) {
                        if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
                                class->has_static_refs = TRUE;
                        else

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to