[NUI] Fix crash issue in widget
authortscholb <scholb.kim@samsung.com>
Mon, 2 May 2022 02:36:58 +0000 (11:36 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 3 May 2022 09:00:21 +0000 (02:00 -0700)
As the widget passes a string to use the creation function, string types makes crash.
To avoid this problem, we use Intptr instead of string when widget sender its Id.

src/Tizen.NUI/src/internal/Widget/WidgetApplication.cs

index e67720f..28d7225 100755 (executable)
@@ -23,7 +23,7 @@ namespace Tizen.NUI
     {
         private Dictionary<System.Type, string> widgetInfo;
         private List<Widget> widgetList = new List<Widget>();
-        private delegate System.IntPtr CreateWidgetFunctionDelegate(ref string widgetName);
+        private delegate System.IntPtr CreateWidgetFunctionDelegate(ref global::System.IntPtr widgetPtr);
         private List<CreateWidgetFunctionDelegate> createWidgetFunctionDelegateList = new List<CreateWidgetFunctionDelegate>();
 
         internal WidgetApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
@@ -115,8 +115,9 @@ namespace Tizen.NUI
             }
         }
 
-        public static System.IntPtr WidgetCreateFunction(ref string widgetName)
+        public static System.IntPtr WidgetCreateFunction(ref global::System.IntPtr widgetPtr)
         {
+            string widgetName = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(widgetPtr);
             if ((Instance as WidgetApplication) == null)
             {
                 return IntPtr.Zero;