From: RinaYou Date: Tue, 14 Nov 2017 07:10:47 +0000 (+0900) Subject: [ElmSharp] Fixed the crash issue because of Interop wrong usage X-Git-Tag: 5.0.0-preview1-00377^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1c9469a6d4b7f6b5bd4711e57ef9afd41faa054;hp=65c82e6ab926fbe26fac521cfeca979befc44880;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [ElmSharp] Fixed the crash issue because of Interop wrong usage Change-Id: Ice8b7d213e85ee36d8b2613c74cd63b5fdcda1a9 --- diff --git a/src/ElmSharp/Interop/Interop.Elementary.Entry.cs b/src/ElmSharp/Interop/Interop.Elementary.Entry.cs old mode 100644 new mode 100755 index b858d5a..0eda07a --- a/src/ElmSharp/Interop/Interop.Elementary.Entry.cs +++ b/src/ElmSharp/Interop/Interop.Elementary.Entry.cs @@ -130,8 +130,14 @@ internal static partial class Interop [DllImport(Libraries.Elementary)] internal static extern void elm_entry_entry_insert(IntPtr obj, string value); - [DllImport(Libraries.Elementary)] - internal static extern void elm_entry_file_get(IntPtr obj, out string file, out TextFormat format); + [DllImport(Libraries.Elementary, EntryPoint = "elm_entry_file_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern void _elm_entry_file_get(IntPtr obj, out IntPtr file, out TextFormat format); + internal static void elm_entry_file_get(IntPtr obj, out string file, out TextFormat format) + { + IntPtr _file; + _elm_entry_file_get(obj, out _file, out format); + file = Marshal.PtrToStringAnsi(_file); + } [DllImport(Libraries.Elementary)] internal static extern void elm_entry_file_set(IntPtr obj, string file, TextFormat format); diff --git a/src/ElmSharp/Interop/Interop.Elementary.Hoversel.cs b/src/ElmSharp/Interop/Interop.Elementary.Hoversel.cs index ca8cefe..1d1f61a 100755 --- a/src/ElmSharp/Interop/Interop.Elementary.Hoversel.cs +++ b/src/ElmSharp/Interop/Interop.Elementary.Hoversel.cs @@ -60,8 +60,16 @@ internal static partial class Interop [DllImport(Libraries.Elementary)] internal static extern void elm_hoversel_item_icon_set(IntPtr obj, string icon_file, string icon_group, int icon_type); - [DllImport(Libraries.Elementary)] - internal static extern void elm_hoversel_item_icon_get(IntPtr obj, out string icon_file, out string icon_group, int icon_type); + [DllImport(Libraries.Elementary, EntryPoint = "elm_hoversel_item_icon_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern void _elm_hoversel_item_icon_get(IntPtr obj, out IntPtr icon_file, out IntPtr icon_group, int icon_type); + internal static void elm_hoversel_item_icon_get(IntPtr obj, out string icon_file, out string icon_group, int icon_type) + { + IntPtr _icon_file; + IntPtr _icon_group; + _elm_hoversel_item_icon_get(obj, out _icon_file, out _icon_group, icon_type); + icon_file = Marshal.PtrToStringAnsi(_icon_file); + icon_group = Marshal.PtrToStringAnsi(_icon_group); + } } } diff --git a/src/ElmSharp/Interop/Interop.Elementary.cs b/src/ElmSharp/Interop/Interop.Elementary.cs old mode 100644 new mode 100755 index 601f8ee..ceef160 --- a/src/ElmSharp/Interop/Interop.Elementary.cs +++ b/src/ElmSharp/Interop/Interop.Elementary.cs @@ -584,14 +584,28 @@ internal static partial class Interop [DllImport(Libraries.Elementary)] internal static extern bool edje_object_text_class_set(IntPtr obj, string textClass, string font, int size); - [DllImport(Libraries.Elementary)] - internal static extern bool edje_object_text_class_get(IntPtr obj, string textClass, out string font, out int size); + [DllImport(Libraries.Elementary, EntryPoint = "edje_object_text_class_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern bool _edje_object_text_class_get(IntPtr obj, string textClass, out IntPtr font, out int size); + internal static bool edje_object_text_class_get(IntPtr obj, string textClass, out string font, out int size) + { + IntPtr _font; + var ret = _edje_object_text_class_get(obj, textClass, out _font, out size); + font = Marshal.PtrToStringAnsi(_font); + return ret; + } [DllImport(Libraries.Elementary)] internal static extern bool edje_text_class_set(string textClass, string font, int size); - [DllImport(Libraries.Elementary)] - internal static extern bool edje_text_class_get(string textClass, out string font, out int size); + [DllImport(Libraries.Elementary, EntryPoint = "edje_text_class_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern bool _edje_text_class_get(string textClass, out IntPtr font, out int size); + internal static bool edje_text_class_get(string textClass, out string font, out int size) + { + IntPtr _font; + var ret = _edje_text_class_get(textClass, out _font, out size); + font = Marshal.PtrToStringAnsi(_font); + return ret; + } [DllImport(Libraries.Elementary)] internal static extern void edje_text_class_del(string textClass);