2007-06-05 Mike Kestner <mkestner@novell.com>

* glib/ManagedValue.cs (ReleaseWrapper): new method.
	* glib/Value.cs : release the ManagedValue wrapper to avoid leaks.
	[Fixes #81799]

svn path=/trunk/gtk-sharp/; revision=78669
This commit is contained in:
Mike Kestner 2007-06-05 19:53:34 +00:00
parent 3e3e0f1469
commit b177644f06
3 changed files with 19 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2007-06-05 Mike Kestner <mkestner@novell.com>
* glib/ManagedValue.cs (ReleaseWrapper): new method.
* glib/Value.cs : release the ManagedValue wrapper to avoid leaks.
[Fixes #81799]
2007-05-03 Wade Berrier <wberrier@novell.com>
* generator/gapi2-codegen.in:

View file

@ -93,6 +93,14 @@ namespace GLib {
return null;
return ((GCHandle)ptr).Target;
}
public static void ReleaseWrapper (IntPtr ptr)
{
if (ptr == IntPtr.Zero)
return;
((GCHandle)ptr).Free ();
}
}
}

View file

@ -376,9 +376,11 @@ namespace GLib {
IntPtr buf = Marshal.AllocHGlobal (Marshal.SizeOf (value.GetType()));
Marshal.StructureToPtr (value, buf, false);
g_value_set_pointer (ref this, buf);
} else if (type == ManagedValue.GType.Val)
g_value_set_boxed (ref this, ManagedValue.WrapObject (value));
else if (g_type_is_a (type, GType.Object.Val))
} else if (type == ManagedValue.GType.Val) {
IntPtr wrapper = ManagedValue.WrapObject (value);
g_value_set_boxed (ref this, wrapper);
ManagedValue.ReleaseWrapper (wrapper);
} else if (g_type_is_a (type, GType.Object.Val))
g_value_set_object (ref this, ((GLib.Object) value).Handle);
else if (g_type_is_a (type, GType.Boxed.Val)) {
if (value is IWrapper) {