All pastes #298293 Raw Edit

Mine

public text v1 · immutable
#298293 ·published 2006-12-31 20:16 UTC
rendered paste body
#! /bin/sh /usr/share/dpatch/dpatch-run
## fix_mono_class_layout_fields_allignment.dpatch by  <fabbione@daltanius.int.fabbione.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad mono-1.2.2.1~/mono/metadata/class.c mono-1.2.2.1/mono/metadata/class.c
--- mono-1.2.2.1~/mono/metadata/class.c 2006-11-17 10:41:09.000000000 -0800
+++ mono-1.2.2.1/mono/metadata/class.c  2006-12-19 06:54:46.000000000 -0800
@@ -1161,9 +1161,10 @@
                                 * see bug #77788
                                 */
                                ftype = mono_type_get_underlying_type (field->type);
-                               if (MONO_TYPE_IS_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype)))))
-                                       align = sizeof (gpointer);
-
+                               if (MONO_TYPE_IS_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype))))) {
+                                       if (align < sizeof (gpointer))
+                                               align = sizeof (gpointer);
+                               }
                                class->min_align = MAX (align, class->min_align);
                                field->offset = real_size;
                                field->offset += align - 1;
~