diff --git a/ChangeLog b/ChangeLog index c2dd15fb3..63a5d194a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-05-01 Mike Kestner + + * glib/Object.cs: get gtype from instance data. + * glib/Value.cs: use instance NativeType when initing for props. + [Fixes #500157] Patch by Sebastian Dröge. + 2009-04-28 Mike Kestner * generator/Parameters.cs: ref parameter marshaling fix. diff --git a/glib/Object.cs b/glib/Object.cs index 882388c84..c0e6eb8fb 100644 --- a/glib/Object.cs +++ b/glib/Object.cs @@ -186,7 +186,7 @@ namespace GLib { } struct GTypeClass { - IntPtr gtype; + public IntPtr gtype; } struct GObjectClass { @@ -323,7 +323,9 @@ namespace GLib { protected GType LookupGType () { - return LookupGType (GetType ()); + GTypeInstance obj = (GTypeInstance) Marshal.PtrToStructure (Handle, typeof (GTypeInstance)); + GTypeClass klass = (GTypeClass) Marshal.PtrToStructure (obj.g_class, typeof (GTypeClass)); + return new GLib.GType (klass.gtype); } protected internal static GType LookupGType (System.Type t) diff --git a/glib/Value.cs b/glib/Value.cs index f8abcc50b..6d143f036 100755 --- a/glib/Value.cs +++ b/glib/Value.cs @@ -518,7 +518,7 @@ namespace GLib { void InitForProperty (Object obj, string name) { - GType gtype = Object.LookupGType (obj.GetType ()); + GType gtype = obj.NativeType; InitForProperty (gtype, name); }