diff --git a/ChangeLog b/ChangeLog index cd107a4b2..70156481b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2001-09-21 * Signal system totally reworked. It should be stable now. + * glib/Object.cs: Rewrote the way the wrapper is kept track of. 2001-09-20 diff --git a/glib/Object.cs b/glib/Object.cs index 64943aa0e..62d713157 100644 --- a/glib/Object.cs +++ b/glib/Object.cs @@ -13,18 +13,11 @@ namespace GLib { public class Object { protected static Hashtable Objects = new Hashtable(); - protected const String GOBJECTKEY = "gobject#-object"; public static Object GetObject(IntPtr o) { - IntPtr key = g_object_get_data (o, GOBJECTKEY); - Object obj; - if((int)key != 0) - { - obj = (Object)Objects[(int)key]; - if (obj != null) return obj; - } - obj = new Object(o); //FIXME: Cast up when we know how. - return obj; + Object obj = (Object)Objects[(int)o]; + if (obj != null) return obj; + return new Object(o); //FIXME: Cast up when we know how. } public Object(IntPtr o) @@ -40,15 +33,8 @@ namespace GLib { return _obj; } set { - IntPtr key = g_object_get_data (value, GOBJECTKEY); - if ((int)key != 0) - { - Object obj = (Object)Objects[(int)key]; - if (obj != null) Objects.Remove((int)key); - } - key = new IntPtr(this.GetHashCode()); - Objects[(int)key] = this; - g_object_set_data (value, GOBJECTKEY, key); + if ((Object)Objects[(int)value] != null) Objects.Remove((int)value); + Objects[(int)value] = this; _obj = value; } }