[NUI] Resolve registry issue for CanvasView Gradient
authorEunki, Hong <eunkiki.hong@samsung.com>
Fri, 13 Oct 2023 04:40:56 +0000 (13:40 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Wed, 25 Oct 2023 12:48:44 +0000 (21:48 +0900)
Since we always try to register to Registry for Gradient case,
there can make some error for Shape use case.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/VectorGraphics/Shape.cs

index 903563f..56f9941 100755 (executable)
@@ -20,6 +20,7 @@ using System.ComponentModel;
 using System.Collections.ObjectModel;
 using System.Collections.Generic;
 using System.Linq;
+using System.Runtime.InteropServices;
 
 namespace Tizen.NUI.BaseComponents.VectorGraphics
 {
@@ -73,7 +74,18 @@ namespace Tizen.NUI.BaseComponents.VectorGraphics
             get
             {
                 global::System.IntPtr cPtr = Interop.Shape.GetFillGradient(BaseHandle.getCPtr(this));
-                Gradient ret = new Gradient(cPtr, true);
+
+                Gradient ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Gradient;
+                if (ret != null)
+                {
+                    HandleRef CPtr = new HandleRef(this, cPtr);
+                    Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                    CPtr = new HandleRef(null, global::System.IntPtr.Zero);
+                }
+                else
+                {
+                    ret = new Gradient(cPtr, true);
+                }
                 return ret;
             }
             set
@@ -149,7 +161,18 @@ namespace Tizen.NUI.BaseComponents.VectorGraphics
             get
             {
                 global::System.IntPtr cPtr = Interop.Shape.GetStrokeGradient(BaseHandle.getCPtr(this));
-                Gradient ret = new Gradient(cPtr, true);
+
+                Gradient ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Gradient;
+                if (ret != null)
+                {
+                    HandleRef CPtr = new HandleRef(this, cPtr);
+                    Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                    CPtr = new HandleRef(null, global::System.IntPtr.Zero);
+                }
+                else
+                {
+                    ret = new Gradient(cPtr, true);
+                }
                 return ret;
             }
             set