[NUI] fix Parent property memory leak (#100)
authordongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 30 Jan 2018 00:05:53 +0000 (09:05 +0900)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Tue, 30 Jan 2018 00:05:53 +0000 (09:05 +0900)
src/Tizen.NUI/src/public/BaseComponents/View.cs

index 15d421f..7655247 100755 (executable)
@@ -4328,11 +4328,8 @@ namespace Tizen.NUI.BaseComponents
             {
                 View ret;
                 IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
-                BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr);
-                //HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
-                //BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
-                //NDalicPINVOKE.delete_BaseHandle(CPtr);
-                //CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+                HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+                BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
 
                 if (basehandle is Layer)
                 {
@@ -4343,6 +4340,9 @@ namespace Tizen.NUI.BaseComponents
                     ret = basehandle as View;
                 }
 
+                NDalicPINVOKE.delete_BaseHandle(CPtr);
+                CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+
                 if (NDalicPINVOKE.SWIGPendingException.Pending)
                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 return ret;