[NUI] Modify GetWidgetViewFromPtr to use ManagedBaseHandle
authortscholb <scholb.kim@samsung.com>
Wed, 3 Aug 2022 04:27:28 +0000 (13:27 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 9 Aug 2022 06:11:38 +0000 (15:11 +0900)
When WidgetView uses its callback, WidgetView gets a crash problem because of referencing object.
To avoid this problem, WidgetView uses ManageBadeHandle.

src/Tizen.NUI/src/public/Widget/WidgetView.cs

index 8c78791..44d6a00 100755 (executable)
@@ -755,7 +755,11 @@ namespace Tizen.NUI
 
         internal static WidgetView GetWidgetViewFromPtr(global::System.IntPtr cPtr)
         {
-            WidgetView ret = new WidgetView(cPtr, false);
+            if (cPtr == global::System.IntPtr.Zero)
+            {
+                return null;
+            }
+            WidgetView ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as WidgetView;
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }