From 73fd05d5179a5e2609029143ecd2c5fe2a9afc1b Mon Sep 17 00:00:00 2001 From: zii-dmg Date: Fri, 15 Oct 2021 17:29:47 +0300 Subject: [PATCH] Fixed Pango.AttrList.Change (#288) pango_attr_list_change takes ownership of attribute so we make copy (as in existing pango_attr_list_insert). --- Source/Libs/PangoSharp/AttrList.cs | 12 +++++++++++- Source/Libs/PangoSharp/PangoSharp.metadata | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/Libs/PangoSharp/AttrList.cs b/Source/Libs/PangoSharp/AttrList.cs index c2ed0d18f..d98fdbcdc 100644 --- a/Source/Libs/PangoSharp/AttrList.cs +++ b/Source/Libs/PangoSharp/AttrList.cs @@ -27,6 +27,16 @@ namespace Pango { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate IntPtr d_pango_attribute_copy(IntPtr raw); static d_pango_attribute_copy pango_attribute_copy = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_attribute_copy")); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + delegate void d_pango_attr_list_change(IntPtr raw, IntPtr attr); + static d_pango_attr_list_change pango_attr_list_change = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_attr_list_change")); + + public void Change (Pango.Attribute attr) + { + pango_attr_list_change (Handle, pango_attribute_copy (attr.Handle)); + } + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void d_pango_attr_list_insert(IntPtr raw, IntPtr attr); static d_pango_attr_list_insert pango_attr_list_insert = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_attr_list_insert")); @@ -35,6 +45,7 @@ namespace Pango { { pango_attr_list_insert (Handle, pango_attribute_copy (attr.Handle)); } + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void d_pango_attr_list_insert_before(IntPtr raw, IntPtr attr); static d_pango_attr_list_insert_before pango_attr_list_insert_before = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_attr_list_insert_before")); @@ -45,4 +56,3 @@ namespace Pango { } } } - diff --git a/Source/Libs/PangoSharp/PangoSharp.metadata b/Source/Libs/PangoSharp/PangoSharp.metadata index 497d0be9f..fcb2b4a83 100644 --- a/Source/Libs/PangoSharp/PangoSharp.metadata +++ b/Source/Libs/PangoSharp/PangoSharp.metadata @@ -1,5 +1,6 @@ + 1 call true 1