[NUI] Resolve many problems relative with BaseHandle
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 31 Oct 2023 03:59:36 +0000 (12:59 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 6 Nov 2023 12:12:22 +0000 (21:12 +0900)
 - Ensure to get 'already registered, or create new one' what we get item from DALi engine
 - Let we also ensure create only one items if we use static ::Get() API
 - Do not register to Registry if we copy the reference.
  - Remove some useless copy constructor.
 - Do not register to Registry if we create empty object.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
24 files changed:
src/Tizen.NUI/src/internal/Common/KeyInputFocusManager.cs
src/Tizen.NUI/src/internal/Common/LinearConstrainer.cs
src/Tizen.NUI/src/internal/Common/ObjectRegistry.cs
src/Tizen.NUI/src/internal/Common/PathConstrainer.cs
src/Tizen.NUI/src/internal/Common/RenderTaskList.cs
src/Tizen.NUI/src/internal/Utility/Builder.cs
src/Tizen.NUI/src/public/Accessibility/AccessibilityManager.cs
src/Tizen.NUI/src/public/Common/PropertyCondition.cs
src/Tizen.NUI/src/public/Common/PropertyNotification.cs
src/Tizen.NUI/src/public/Common/StyleManager.cs
src/Tizen.NUI/src/public/Common/TypeInfo.cs
src/Tizen.NUI/src/public/Common/TypeRegistry.cs
src/Tizen.NUI/src/public/Events/Hover.cs
src/Tizen.NUI/src/public/Events/Touch.cs
src/Tizen.NUI/src/public/Images/EncodedImageBuffer.cs
src/Tizen.NUI/src/public/Images/PixelBuffer.cs
src/Tizen.NUI/src/public/Input/AutofillContainer.cs
src/Tizen.NUI/src/public/Utility/FontClient.cs
src/Tizen.NUI/src/public/Utility/TTSPlayer.cs
src/Tizen.NUI/src/public/Utility/Timer.cs
src/Tizen.NUI/src/public/Visuals/VisualBase.cs
src/Tizen.NUI/src/public/Visuals/VisualFactory.cs
src/Tizen.NUI/src/public/Widget/WidgetView.cs
src/Tizen.NUI/src/public/Window/Window.cs

index 3609769e24e259cff0f59e8a4545fc5d506656e7..4092380b7dc81fd93a98fc918d75591be13124b2 100755 (executable)
@@ -37,7 +37,22 @@ namespace Tizen.NUI
 
         public static KeyInputFocusManager Get()
         {
-            KeyInputFocusManager ret = new KeyInputFocusManager(Interop.KeyInputFocusManager.Get(), true);
+            global::System.IntPtr cPtr = Interop.KeyInputFocusManager.Get();
+
+            KeyInputFocusManager ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as KeyInputFocusManager;
+            if (ret != null)
+            {
+                object dummyObect = new object();
+
+                global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(dummyObect, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new KeyInputFocusManager(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
index 88da7e531b18c82ebe76883205cb933b51a20139..6f07d87f3011ff5bf4bb05bb387533217c78813d 100755 (executable)
@@ -46,11 +46,6 @@ namespace Tizen.NUI
             return ret;
         }
 
-        internal LinearConstrainer(LinearConstrainer handle) : this(Interop.LinearConstrainer.NewLinearConstrainer(LinearConstrainer.getCPtr(handle)), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
         internal LinearConstrainer Assign(LinearConstrainer rhs)
         {
             LinearConstrainer ret = new LinearConstrainer(Interop.LinearConstrainer.Assign(SwigCPtr, LinearConstrainer.getCPtr(rhs)), false);
index 7fc85dcea666edbc4ba739b1a2a9a022a9bea189..15f25f7ee6220bb995f1a7e738d86346ed7de62a 100755 (executable)
@@ -22,7 +22,11 @@ namespace Tizen.NUI
 {
     internal class ObjectRegistry : BaseHandle
     {
-        internal ObjectRegistry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        internal ObjectRegistry(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
+        {
+        }
+
+        internal ObjectRegistry(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
         {
         }
 
@@ -156,12 +160,7 @@ namespace Tizen.NUI
         }
 
 
-        public ObjectRegistry() : this(Interop.ObjectRegistry.NewObjectRegistry(), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        public ObjectRegistry(ObjectRegistry handle) : this(Interop.ObjectRegistry.NewObjectRegistry(ObjectRegistry.getCPtr(handle)), true)
+        public ObjectRegistry() : this(Interop.ObjectRegistry.NewObjectRegistry(), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
index 37a8b4115f1a10e3a1fd107c99df3b2682862257..38f896e9ae690784e4f3ba7b68e7b02163e062f9 100755 (executable)
@@ -47,11 +47,6 @@ namespace Tizen.NUI
             return ret;
         }
 
-        internal PathConstrainer(PathConstrainer handle) : this(Interop.PathConstrainer.NewPathConstrainer(PathConstrainer.getCPtr(handle)), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
         internal PathConstrainer Assign(PathConstrainer rhs)
         {
             PathConstrainer ret = new PathConstrainer(Interop.PathConstrainer.Assign(SwigCPtr, PathConstrainer.getCPtr(rhs)), false);
index f47c59a52fd4cb5be5f821bdaf1446ea3a965e30..57cbb97efc121af6e1d9e92938e70fae9c59224e 100755 (executable)
@@ -52,14 +52,7 @@ namespace Tizen.NUI
             return ret;
         }
 
-        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public RenderTaskList(RenderTaskList handle) : this(Interop.RenderTask.NewRenderTaskList(RenderTaskList.getCPtr(handle)), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        public RenderTaskList Assign(RenderTaskList rhs)
+        internal RenderTaskList Assign(RenderTaskList rhs)
         {
             RenderTaskList ret = new RenderTaskList(Interop.RenderTask.RenderTaskListAssign(SwigCPtr, RenderTaskList.getCPtr(rhs)), false);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
index 3a52b072307d4d528900e663e2dc636dc4ca1fbd..e31516aa9f7e8d1d133847e226ee1d86473bb3a5 100755 (executable)
@@ -237,14 +237,40 @@ namespace Tizen.NUI
 
         internal PathConstrainer GetPathConstrainer(string pathConstrainerName)
         {
-            PathConstrainer ret = new PathConstrainer(Interop.Builder.GetPathConstrainer(SwigCPtr, pathConstrainerName), true);
+            global::System.IntPtr cPtr = Interop.Builder.GetPathConstrainer(SwigCPtr, pathConstrainerName);
+
+            PathConstrainer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as PathConstrainer;
+            if (ret != null)
+            {
+                global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new PathConstrainer(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
 
         internal LinearConstrainer GetLinearConstrainer(string linearConstrainerName)
         {
-            LinearConstrainer ret = new LinearConstrainer(Interop.Builder.GetLinearConstrainer(SwigCPtr, linearConstrainerName), true);
+            global::System.IntPtr cPtr = Interop.Builder.GetLinearConstrainer(SwigCPtr, linearConstrainerName);
+
+            LinearConstrainer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as LinearConstrainer;
+            if (ret != null)
+            {
+                global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new LinearConstrainer(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
index 385e0761d1113f1296b9c5ffe79543110ea2fcf2..bd8b15a48c24a7acd0afe02629134af222ecdee8 100755 (executable)
@@ -700,7 +700,22 @@ namespace Tizen.NUI.Accessibility
 
         internal static AccessibilityManager Get()
         {
-            AccessibilityManager ret = new AccessibilityManager(Interop.AccessibilityManager.Get(), true);
+            global::System.IntPtr cPtr = Interop.AccessibilityManager.Get();
+
+            AccessibilityManager ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as AccessibilityManager;
+            if (ret != null)
+            {
+                object dummyObect = new object();
+
+                global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(dummyObect, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new AccessibilityManager(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
index 26b7facda04714ed0f50fd5d1eef0e8d3dc25cd6..962160b649cf16fdda1fde9a556c428fb15a6d2c 100755 (executable)
@@ -29,12 +29,16 @@ namespace Tizen.NUI
         /// Create a property condition instance.
         /// </summary>
         /// <since_tizen> 4 </since_tizen>
-        public PropertyCondition() : this(Interop.PropertyCondition.NewPropertyCondition(), true)
+        public PropertyCondition() : this(Interop.PropertyCondition.NewPropertyCondition(), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal PropertyCondition(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        internal PropertyCondition(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
+        {
+        }
+
+        internal PropertyCondition(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
         {
         }
 
index c323adb378b4c280f6d2bdad0a47d3c9c575d00e..5abe8edd285a08f18475b065474c5d4118ff808e 100755 (executable)
@@ -36,7 +36,7 @@ namespace Tizen.NUI
         /// Create a instance of PropertyNotification.
         /// </summary>
         /// <since_tizen> 4 </since_tizen>
-        public PropertyNotification() : this(Interop.PropertyNotification.NewPropertyNotification(), true)
+        public PropertyNotification() : this(Interop.PropertyNotification.NewPropertyNotification(), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
@@ -45,12 +45,16 @@ namespace Tizen.NUI
         /// Create a instance of PropertyNotification.
         /// </summary>
         /// <since_tizen> 4 </since_tizen>
-        public PropertyNotification(PropertyNotification handle) : this(Interop.PropertyNotification.NewPropertyNotification(PropertyNotification.getCPtr(handle)), true)
+        public PropertyNotification(PropertyNotification handle) : this(Interop.PropertyNotification.NewPropertyNotification(PropertyNotification.getCPtr(handle)), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal PropertyNotification(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        internal PropertyNotification(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
+        {
+        }
+
+        internal PropertyNotification(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
         {
         }
 
@@ -170,7 +174,20 @@ namespace Tizen.NUI
         /// <since_tizen> 4 </since_tizen>
         public PropertyCondition GetCondition()
         {
-            PropertyCondition ret = new PropertyCondition(Interop.PropertyNotification.GetCondition(SwigCPtr), true);
+            global::System.IntPtr cPtr = Interop.PropertyNotification.GetCondition(SwigCPtr);
+
+            PropertyCondition ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as PropertyCondition;
+            if (ret != null)
+            {
+                global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new PropertyCondition(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
index e827ecfdedd5d55a4a0ca2bc1b5fff84eb5ee3a6..85dcd4cf0059e283e8334fffcb8e0d59d8e01c64 100755 (executable)
@@ -43,7 +43,7 @@ namespace Tizen.NUI
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         [Obsolete("Deprecated in API9, will be removed in API11. Use ThemeManager instead.")]
-        public StyleManager() : this(Interop.StyleManager.NewStyleManager(), true)
+        public StyleManager() : this(Interop.StyleManager.NewStyleManager(), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
@@ -101,7 +101,22 @@ namespace Tizen.NUI
         [Obsolete("Deprecated in API9, will be removed in API11. Use ThemeManager instead.")]
         public static StyleManager Get()
         {
-            StyleManager ret = new StyleManager(Interop.StyleManager.Get(), true);
+            global::System.IntPtr cPtr = Interop.StyleManager.Get();
+
+            StyleManager ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as StyleManager;
+            if (ret != null)
+            {
+                object dummyObect = new object();
+
+                HandleRef CPtr = new HandleRef(dummyObect, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new StyleManager(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -212,7 +227,11 @@ namespace Tizen.NUI
             return ret;
         }
 
-        internal StyleManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        internal StyleManager(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
+        {
+        }
+
+        internal StyleManager(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
         {
         }
 
index 808d51431ef7beb813bc6b853f7460c79e72d2e0..23f50200902b0dc9e7be5e9b37a6a3f8d9c24e39 100755 (executable)
@@ -30,7 +30,7 @@ namespace Tizen.NUI
         /// Creates TypeInfo object.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        public TypeInfo() : this(Interop.TypeInfo.NewTypeInfo(), true)
+        public TypeInfo() : this(Interop.TypeInfo.NewTypeInfo(), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
index d852a69174380c44eb54871df6e6671eea2ec4a4..2733b180686671b31fd5c60af2cf8d8c66d93caa 100755 (executable)
@@ -26,8 +26,11 @@ namespace Tizen.NUI
     [EditorBrowsable(EditorBrowsableState.Never)]
     public class TypeRegistry : BaseHandle
     {
+        internal TypeRegistry(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
+        {
+        }
 
-        internal TypeRegistry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        internal TypeRegistry(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
         {
         }
 
@@ -46,7 +49,22 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static TypeRegistry Get()
         {
-            TypeRegistry ret = new TypeRegistry(Interop.TypeRegistry.Get(), true);
+            global::System.IntPtr cPtr = Interop.TypeRegistry.Get();
+
+            TypeRegistry ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as TypeRegistry;
+            if (ret != null)
+            {
+                object dummyObect = new object();
+
+                global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(dummyObect, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new TypeRegistry(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -56,12 +74,12 @@ namespace Tizen.NUI
         /// </summary>
         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public TypeRegistry() : this(Interop.TypeRegistry.NewTypeRegistry(), true)
+        public TypeRegistry() : this(Interop.TypeRegistry.NewTypeRegistry(), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal TypeRegistry(TypeRegistry handle) : this(Interop.TypeRegistry.NewTypeRegistry(TypeRegistry.getCPtr(handle)), true)
+        internal TypeRegistry(TypeRegistry handle) : this(Interop.TypeRegistry.NewTypeRegistry(TypeRegistry.getCPtr(handle)), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
@@ -82,7 +100,20 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Tizen.NUI.TypeInfo GetTypeInfo(string uniqueTypeName)
         {
-            Tizen.NUI.TypeInfo ret = new Tizen.NUI.TypeInfo(Interop.TypeRegistry.GetTypeInfo(SwigCPtr, uniqueTypeName), true);
+            global::System.IntPtr cPtr = Interop.TypeRegistry.GetTypeInfo(SwigCPtr, uniqueTypeName);
+
+            Tizen.NUI.TypeInfo ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Tizen.NUI.TypeInfo;
+            if (ret != null)
+            {
+                global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new Tizen.NUI.TypeInfo(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
index 2f216d2fc4cb8a1ba5ade211b9e7b5ee549c80a6..b202e84b9ca70013f4208547315dec8a39066fdd 100755 (executable)
@@ -47,11 +47,6 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal Hover(Hover other) : this(Interop.Hover.NewHover(Hover.getCPtr(other)), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
         internal Hover(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
         {
         }
index 1028422ff8774d7dce0b1bf291aee75c82dbd470..3ca98317f26a1ba056b94b33ea0aedebe1c6359c 100755 (executable)
@@ -32,12 +32,7 @@ namespace Tizen.NUI
         /// Calling member functions with an uninitialized touch handle is not allowed.<br />
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        public Touch() : this(Interop.Touch.NewTouch(), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        internal Touch(Touch other) : this(Interop.Touch.NewTouch(Touch.getCPtr(other)), true)
+        public Touch() : this(Interop.Touch.NewTouch(), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
index 399fd98bd83d6d55cddfba62ab4b1aed9a09e595..17f981482f455b3f5eb39f1922c653d829ac952f 100644 (file)
@@ -56,11 +56,6 @@ namespace Tizen.NUI
             mCachedBuffer = buffer;
         }
 
-        internal EncodedImageBuffer(EncodedImageBuffer handle) : this(Interop.EncodedImageBuffer.NewEncodedImageBuffer(EncodedImageBuffer.getCPtr(handle)), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
         internal EncodedImageBuffer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
         {
         }
index 79c74d0929638bdaa0e01183886313c1a38f883b..bb1c41c6f93bcb30779e0325ff253be077d0fbc5 100755 (executable)
@@ -51,7 +51,7 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal PixelBuffer(PixelBuffer handle) : this(Interop.PixelBuffer.NewPixelBuffer(PixelBuffer.getCPtr(handle)), true)
+        internal PixelBuffer(PixelBuffer handle) : this(Interop.PixelBuffer.NewPixelBuffer(PixelBuffer.getCPtr(handle)), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
index b28784a8cac7465794e8a4a328bf6ce484cf22ed..3068a5c4d0bebd533cc0d8a6b3f4f3df1a1233b0 100755 (executable)
@@ -105,11 +105,15 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal AutofillContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        internal AutofillContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
         {
         }
 
-        internal AutofillContainer(AutofillContainer autofillContainer) : this(Interop.AutofillContainer.NewAutofillContainer(AutofillContainer.getCPtr(autofillContainer)), true)
+        internal AutofillContainer(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
+        {
+        }
+
+        internal AutofillContainer(AutofillContainer autofillContainer) : this(Interop.AutofillContainer.NewAutofillContainer(AutofillContainer.getCPtr(autofillContainer)), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
index 81a66428f198e9aa38fec54ec02114dacb1264b2..7fb9c8a3f3f7b8611e669f316589b666141e84b6 100755 (executable)
@@ -38,11 +38,6 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal FontClient(FontClient handle) : this(Interop.FontClient.NewFontClient(FontClient.getCPtr(handle)), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
         internal static uint DefaultPointSize
         {
             get
@@ -291,7 +286,22 @@ namespace Tizen.NUI
 
         internal static FontClient Get()
         {
-            FontClient ret = new FontClient(Interop.FontClient.Get(), true);
+            global::System.IntPtr cPtr = Interop.FontClient.Get();
+
+            FontClient ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as FontClient;
+            if (ret != null)
+            {
+                object dummyObect = new object();
+
+                global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(dummyObect, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new FontClient(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
index 6712905f7e3ff85bcdce3fb6f2ef4d25aaa49910..7c459880acda26ee716d6fdd46be54d9ae75e2b7 100755 (executable)
@@ -30,16 +30,20 @@ namespace Tizen.NUI
         private static readonly TTSPlayer instance = TTSPlayer.Get();
         private StateChangedEventCallbackType stateChangedEventCallback;
 
-        internal TTSPlayer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.TtsPlayer.Upcast(cPtr), cMemoryOwn)
+        internal TTSPlayer(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
         {
         }
 
-        internal TTSPlayer() : this(Interop.TtsPlayer.NewTtsPlayer(), true)
+        internal TTSPlayer(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
+        {
+        }
+
+        internal TTSPlayer() : this(Interop.TtsPlayer.NewTtsPlayer(), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal TTSPlayer(TTSPlayer handle) : this(Interop.TtsPlayer.NewTtsPlayer(TTSPlayer.getCPtr(handle)), true)
+        internal TTSPlayer(TTSPlayer handle) : this(Interop.TtsPlayer.NewTtsPlayer(TTSPlayer.getCPtr(handle)), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
@@ -145,7 +149,22 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public static TTSPlayer Get(TTSMode mode)
         {
-            TTSPlayer ret = new TTSPlayer(Interop.TtsPlayer.Get((int)mode), true);
+            global::System.IntPtr cPtr = Interop.TtsPlayer.Get((int)mode);
+
+            TTSPlayer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as TTSPlayer;
+            if (ret != null)
+            {
+                object dummyObect = new object();
+
+                HandleRef CPtr = new HandleRef(dummyObect, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new TTSPlayer(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -157,7 +176,22 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public static TTSPlayer Get()
         {
-            TTSPlayer ret = new TTSPlayer(Interop.TtsPlayer.Get(), true);
+            global::System.IntPtr cPtr = Interop.TtsPlayer.Get();
+
+            TTSPlayer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as TTSPlayer;
+            if (ret != null)
+            {
+                object dummyObect = new object();
+
+                HandleRef CPtr = new HandleRef(dummyObect, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new TTSPlayer(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
index b17c72c71c4512a4c5ef1b9bcfafd71cbf77ed6e..e796e3847e03b2309ce2fe7450e54641bf4a895d 100755 (executable)
@@ -53,12 +53,16 @@ namespace Tizen.NUI
 
             NUILog.Debug($"(0x{SwigCPtr.Handle:X})  Timer({milliSec}) Constructor!");
         }
-        internal Timer(Timer timer) : this(Interop.Timer.NewTimer(Timer.getCPtr(timer)), true)
+        internal Timer(Timer timer) : this(Interop.Timer.NewTimer(Timer.getCPtr(timer)), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
+        {
+        }
+
+        internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
         {
             timerTickCallbackDelegate = OnTick;
             timerTickCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(timerTickCallbackDelegate);
index 8c9a5be0bb9b5dd6ed56c548b2928ec3505ed6c3..bcfa3bcd64fd777bf375d6e1b43b54f16f386c1c 100755 (executable)
@@ -33,16 +33,21 @@ namespace Tizen.NUI
         /// Creates an empty visual handle.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        public VisualBase() : this(Interop.VisualBase.NewVisualBase(), true)
+        public VisualBase() : this(Interop.VisualBase.NewVisualBase(), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal VisualBase(VisualBase handle) : this(Interop.VisualBase.NewVisualBase(VisualBase.getCPtr(handle)), true)
+        internal VisualBase(VisualBase handle) : this(Interop.VisualBase.NewVisualBase(VisualBase.getCPtr(handle)), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
-        internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+
+        internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
+        {
+        }
+
+        internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
         {
         }
 
index ab2a33a102e56dae120add1a4166d7c17bc8cce8..ef365adffde830a9369f9e49e5f92911eb8743a8 100755 (executable)
@@ -31,11 +31,11 @@ namespace Tizen.NUI
         /// </summary>
         private static VisualFactory instance;
 
-        internal VisualFactory(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        private VisualFactory(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
         {
         }
 
-        internal VisualFactory() : this(Interop.VisualFactory.NewVisualFactory(), true)
+        private VisualFactory() : this(Interop.VisualFactory.NewVisualFactory(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
index 0732e873938d53103129ac210ff916dcec0d59ac..7d16ae86dc927eb6326b6227a75080b85ade73ec 100755 (executable)
@@ -195,10 +195,15 @@ namespace Tizen.NUI
 
         }
 
-        internal WidgetView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        internal WidgetView(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
         {
         }
-        internal WidgetView(WidgetView handle) : this(Interop.WidgetView.NewWidgetView(WidgetView.getCPtr(handle)), true)
+
+        internal WidgetView(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, true, cRegister)
+        {
+        }
+
+        internal WidgetView(WidgetView handle) : this(Interop.WidgetView.NewWidgetView(WidgetView.getCPtr(handle)), true, false)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
index 6df4dd112cf8d3fec829d49629aad6ba26d04ee1..4772bb9dde8db9199866146afb3285ec458426f8 100755 (executable)
@@ -1634,7 +1634,20 @@ namespace Tizen.NUI
 
         internal ObjectRegistry GetObjectRegistry()
         {
-            ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
+            global::System.IntPtr cPtr = Interop.Stage.GetObjectRegistry(stageCPtr);
+
+            ObjectRegistry ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as ObjectRegistry;
+            if (ret != null)
+            {
+                global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+                Interop.BaseHandle.DeleteBaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            else
+            {
+                ret = new ObjectRegistry(cPtr, true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }