2009-07-21 Christian Hoff <christian_hoff@gmx.net>
* glib/GInterfaceAdapter.cs: Fix a leak related to GCHandles not being freed. Patch from Mike Kestner with a minor tweak by me. [Fixes #523306] svn path=/trunk/gtk-sharp/; revision=138263
This commit is contained in:
parent
1cd652998e
commit
a7bebb15b1
1 changed files with 3 additions and 8 deletions
|
@ -40,8 +40,6 @@ namespace GLib {
|
||||||
|
|
||||||
protected GInterfaceAdapter ()
|
protected GInterfaceAdapter ()
|
||||||
{
|
{
|
||||||
info.FinalizeHandler = new GInterfaceFinalizeHandler (Finalize);
|
|
||||||
info.Data = (IntPtr) GCHandle.Alloc (this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected GInterfaceInitHandler InitHandler {
|
protected GInterfaceInitHandler InitHandler {
|
||||||
|
@ -56,14 +54,11 @@ namespace GLib {
|
||||||
|
|
||||||
internal GInterfaceInfo Info {
|
internal GInterfaceInfo Info {
|
||||||
get {
|
get {
|
||||||
|
if (info.Data == IntPtr.Zero)
|
||||||
|
info.Data = (IntPtr) GCHandle.Alloc (this);
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Finalize (IntPtr iface_ptr, IntPtr data)
|
|
||||||
{
|
|
||||||
GCHandle gch = (GCHandle) data;
|
|
||||||
gch.Free ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue