[ElmSharp] Fixed the crash issue because of Interop wrong usage 37/160037/1 4.0.1-preview1-00022
authorRinaYou <rina6350.you@samsung.com>
Tue, 14 Nov 2017 07:10:47 +0000 (16:10 +0900)
committerrina you <rina6350.you@samsung.com>
Tue, 14 Nov 2017 07:50:04 +0000 (07:50 +0000)
Change-Id: Ice8b7d213e85ee36d8b2613c74cd63b5fdcda1a9
(cherry picked from commit d1c9469a6d4b7f6b5bd4711e57ef9afd41faa054)

src/ElmSharp/Interop/Interop.Elementary.Entry.cs [changed mode: 0644->0755]
src/ElmSharp/Interop/Interop.Elementary.Hoversel.cs
src/ElmSharp/Interop/Interop.Elementary.cs [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index b858d5a..0eda07a
@@ -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);
index ca8cefe..1d1f61a 100755 (executable)
@@ -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);
+        }
     }
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 601f8ee..ceef160
@@ -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);