diff --git a/Source/generator/ClassBase.cs b/Source/generator/ClassBase.cs index fb6a6e86a..09a84b6d1 100644 --- a/Source/generator/ClassBase.cs +++ b/Source/generator/ClassBase.cs @@ -190,10 +190,12 @@ namespace GtkSharp.Generation { protected virtual void WriteInstanceOffsetMethod(StreamWriter sw, string cs_parent_struct) { + string cs_parent = SymbolTable.Table.GetCSType(Elem.GetAttribute("parent")); + if (cs_parent_struct == "") - sw.WriteLine ("\t\tpublic virtual uint instance_offset { get { return 0; }}"); + sw.WriteLine ("\t\tpublic static uint instance_offset { get { return 0; }}"); else - sw.WriteLine ("\t\tpublic override uint instance_offset {{ get {{ return ((uint) Marshal.SizeOf(typeof ({0})) + base.instance_offset); }} }}", cs_parent_struct); + sw.WriteLine ("\t\tpublic static uint instance_offset {{ get {{ return ((uint) Marshal.SizeOf(typeof ({0})) + {1}.instance_offset); }} }}", cs_parent_struct, cs_parent); } protected void GenerateStructureABI (GenerationInfo gen_info) diff --git a/Source/glib/Object.cs b/Source/glib/Object.cs index 3e995ac1f..7adb3dc4b 100644 --- a/Source/glib/Object.cs +++ b/Source/glib/Object.cs @@ -823,7 +823,7 @@ namespace GLib { public IntPtr g_class; } - public virtual uint instance_offset { get { return 0; }} + public static uint instance_offset { get { return 0; }} public uint GetFieldOffset(string field) { throw new NotImplementedException(); return 0; } public struct GObject { public GTypeInstance type_instance;