mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-24 12:05:34 +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>
|
2002-10-26 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
* api/*.xml : get libgda and libgnomedb metadata setup
|
* api/*.xml : get libgda and libgnomedb metadata setup
|
||||||
|
|
|
@ -61,6 +61,8 @@ namespace GLib {
|
||||||
if (_obj == IntPtr.Zero)
|
if (_obj == IntPtr.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Objects.Remove (Raw);
|
||||||
|
|
||||||
GC.SuppressFinalize (this);
|
GC.SuppressFinalize (this);
|
||||||
g_object_unref (_obj);
|
g_object_unref (_obj);
|
||||||
_obj = IntPtr.Zero;
|
_obj = IntPtr.Zero;
|
||||||
|
@ -104,8 +106,9 @@ namespace GLib {
|
||||||
|
|
||||||
public static Object GetObject(IntPtr o)
|
public static Object GetObject(IntPtr o)
|
||||||
{
|
{
|
||||||
Object obj = (Object)Objects[o];
|
WeakReference obj = Objects[o] as WeakReference;
|
||||||
if (obj != null) return obj;
|
if (obj != null)
|
||||||
|
return obj.Target as GLib.Object;
|
||||||
return GtkSharp.ObjectManager.CreateObject(o);
|
return GtkSharp.ObjectManager.CreateObject(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +120,8 @@ namespace GLib {
|
||||||
/// Dummy constructor needed for derived classes.
|
/// Dummy constructor needed for derived classes.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public Object () {}
|
public Object () {
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Object Constructor
|
/// Object Constructor
|
||||||
|
@ -148,7 +152,7 @@ namespace GLib {
|
||||||
return _obj;
|
return _obj;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
Objects [value] = this;
|
Objects [value] = new WeakReference (this);
|
||||||
_obj = value;
|
_obj = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue