Author: lluis
Date: 2007-09-07 09:57:25 -0400 (Fri, 07 Sep 2007)
New Revision: 85475

Modified:
   branches/gtk-sharp-2-468-branch/gtk-sharp/ChangeLog
   branches/gtk-sharp-2-468-branch/gtk-sharp/glib/Object.cs
Log:
2007-09-07  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 

        * glib/Object.cs: In InvokeClassInitializers, look for initializers
        in every type in the type hierarchy, and check
        IgnoreClassInitializersAttribute on each of them. It avoids
        checking inherited methods that don't need to be checked.



Modified: branches/gtk-sharp-2-468-branch/gtk-sharp/ChangeLog
===================================================================
--- branches/gtk-sharp-2-468-branch/gtk-sharp/ChangeLog 2007-09-07 13:27:23 UTC 
(rev 85474)
+++ branches/gtk-sharp-2-468-branch/gtk-sharp/ChangeLog 2007-09-07 13:57:25 UTC 
(rev 85475)
@@ -1,3 +1,10 @@
+2007-09-07  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 
+
+       * glib/Object.cs: In InvokeClassInitializers, look for initializers
+       in every type in the type hierarchy, and check
+       IgnoreClassInitializersAttribute on each of them. It avoids
+       checking inherited methods that don't need to be checked.
+
 2007-09-07  Lluis Sanchez Gual  <[EMAIL PROTECTED]>
 
        * glib/Object.cs: In GetObject(), avoid unneeded calls to

Modified: branches/gtk-sharp-2-468-branch/gtk-sharp/glib/Object.cs
===================================================================
--- branches/gtk-sharp-2-468-branch/gtk-sharp/glib/Object.cs    2007-09-07 
13:27:23 UTC (rev 85474)
+++ branches/gtk-sharp-2-468-branch/gtk-sharp/glib/Object.cs    2007-09-07 
13:57:25 UTC (rev 85475)
@@ -165,14 +165,16 @@
                                if (m != null)
                                        m.Invoke (null, parms);
                        }
+                       
+                       for (Type curType = t; curType != typeof(object); 
curType = curType.BaseType) {
 
-                       if (t.Assembly.GetCustomAttributes (typeof 
(IgnoreClassInitializersAttribute), false).Length != 0)
-                               return;
+                               if (curType.Assembly.IsDefined (typeof 
(IgnoreClassInitializersAttribute), false))
+                                       continue;
 
-                       flags |= BindingFlags.FlattenHierarchy;
-                       foreach (MethodInfo minfo in t.GetMethods(flags))
-                               if (minfo.IsDefined (typeof 
(ClassInitializerAttribute), true))
-                                       minfo.Invoke (null, parms);
+                               foreach (MethodInfo minfo in 
curType.GetMethods(flags))
+                                       if (minfo.IsDefined (typeof 
(ClassInitializerAttribute), true))
+                                               minfo.Invoke (null, parms);
+                       }
                }
 
                [DllImport("glibsharpglue-2")]

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to