[NUI] Refactor dispose pattern to reduce duplication (#1112)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / WidgetImpl.cs
index 884e547..b54177b 100755 (executable)
@@ -22,7 +22,6 @@ namespace Tizen.NUI
 {
     internal class WidgetImpl : BaseObject
     {
-        private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
         internal WidgetImpl() : this( Interop.WidgetImpl.WidgetImpl_New(), true )
         {
@@ -31,7 +30,6 @@ namespace Tizen.NUI
 
         internal WidgetImpl(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WidgetImpl.WidgetImpl_SWIGUpcast(cPtr), cMemoryOwn)
         {
-            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
         }
 
         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetImpl obj)
@@ -39,28 +37,9 @@ namespace Tizen.NUI
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
-        protected override void Dispose(DisposeTypes type)
+        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
         {
-            if (disposed)
-            {
-                return;
-            }
-
-            //Release your own unmanaged resources here.
-            //You should not access any managed member here except static instance.
-            //because the execution order of Finalizes is non-deterministic.
-
-            if (swigCPtr.Handle != global::System.IntPtr.Zero)
-            {
-                if (swigCMemOwn)
-                {
-                    swigCMemOwn = false;
-                    //throw new global::System.MethodAccessException("C++ destructor does not have public access");
-                }
-                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
-            }
-
-            base.Dispose(type);
+            //throw new global::System.MethodAccessException("C++ destructor does not have public access");
         }
 
         public class WIdgetInstanceOnCreateArgs : EventArgs