mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 18:05:29 +00:00
Changed so that Objects is a hash of
WeakReferences instead of hashing the real objects. Without this change, GObjects were never collected. (Raw, set): Put a WeakReference to the object in Objects. (Object.GetObject): Get the WeakReference from Objects, and from there the actual object. (Object.DisposeNative): Remove the Raw pointer from Objects. svn path=/trunk/gtk-sharp/; revision=8578
This commit is contained in:
parent
2e07bf7e87
commit
cf139575c2
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2002-10-26 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* glib/Object.cs: Changed so that Objects is a hash of
|
||||
WeakReferences instead of hashing the real objects. Without this
|
||||
change, GObjects were never collected.
|
||||
(Raw, set): Put a WeakReference to the object in Objects.
|
||||
(Object.GetObject): Get the WeakReference from Objects, and from
|
||||
there the actual object.
|
||||
(Object.DisposeNative): Remove the Raw pointer from Objects.
|
||||
|
||||
2002-10-26 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* api/*.xml : get libgda and libgnomedb metadata setup
|
||||
|
|
|
@ -61,6 +61,8 @@ namespace GLib {
|
|||
if (_obj == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
Objects.Remove (Raw);
|
||||
|
||||
GC.SuppressFinalize (this);
|
||||
g_object_unref (_obj);
|
||||
_obj = IntPtr.Zero;
|
||||
|
@ -104,8 +106,9 @@ namespace GLib {
|
|||
|
||||
public static Object GetObject(IntPtr o)
|
||||
{
|
||||
Object obj = (Object)Objects[o];
|
||||
if (obj != null) return obj;
|
||||
WeakReference obj = Objects[o] as WeakReference;
|
||||
if (obj != null)
|
||||
return obj.Target as GLib.Object;
|
||||
return GtkSharp.ObjectManager.CreateObject(o);
|
||||
}
|
||||
|
||||
|
@ -117,7 +120,8 @@ namespace GLib {
|
|||
/// Dummy constructor needed for derived classes.
|
||||
/// </remarks>
|
||||
|
||||
public Object () {}
|
||||
public Object () {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Object Constructor
|
||||
|
@ -148,7 +152,7 @@ namespace GLib {
|
|||
return _obj;
|
||||
}
|
||||
set {
|
||||
Objects [value] = this;
|
||||
Objects [value] = new WeakReference (this);
|
||||
_obj = value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue