Object: Fix string leakages

This commit is contained in:
Justin Kim 2018-01-30 01:09:23 +09:00 committed by Harry
parent 7d5190865e
commit c980ef4f90

View file

@ -511,6 +511,7 @@ namespace GLib {
{
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
g_object_class_override_property (oclass, property_id, native_name);
GLib.Marshaller.Free (native_name);
}
[Obsolete ("Use OverrideProperty(oclass,property_id,name)")]
@ -527,8 +528,15 @@ namespace GLib {
{
IntPtr gobjectclass = Marshal.ReadIntPtr (o.Handle);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
try
{
return g_object_class_find_property (gobjectclass, native_name);
}
finally
{
GLib.Marshaller.Free (native_name);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_object_interface_find_property(IntPtr klass, IntPtr name);
static d_g_object_interface_find_property g_object_interface_find_property = FuncLoader.LoadFunction<d_g_object_interface_find_property>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_object_interface_find_property"));
@ -537,8 +545,15 @@ namespace GLib {
{
IntPtr g_iface = type.GetDefaultInterfacePtr ();
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
try
{
return g_object_interface_find_property (g_iface, native_name);
}
finally
{
GLib.Marshaller.Free (native_name);
}
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_object_class_install_property(IntPtr klass, uint prop_id, IntPtr param_spec);
static d_g_object_class_install_property g_object_class_install_property = FuncLoader.LoadFunction<d_g_object_class_install_property>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_object_class_install_property"));