sync with devel/master branch
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / UIComponents / CheckBoxButton.cs
index 3fdf472..d0392c1 100755 (executable)
@@ -45,28 +45,35 @@ namespace Tizen.NUI.UIComponents
         /// <summary>
         /// To make CheckBoxButton instance be disposed.
         /// </summary>
-        public override void Dispose()
+        protected override void Dispose(DisposeTypes type)
         {
-            if (!Window.IsInstalled())
+            if (disposed)
             {
-                DisposeQueue.Instance.Add(this);
                 return;
             }
 
-            lock (this)
+            if(type == DisposeTypes.Explicit)
             {
-                if (swigCPtr.Handle != global::System.IntPtr.Zero)
+                //Called by User
+                //Release your own managed resources here.
+                //You should release all of your own disposable objects here.
+            }
+
+            //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)
                 {
-                    if (swigCMemOwn)
-                    {
-                        swigCMemOwn = false;
-                        NDalicPINVOKE.delete_CheckBoxButton(swigCPtr);
-                    }
-                    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+                    swigCMemOwn = false;
+                    NDalicPINVOKE.delete_CheckBoxButton(swigCPtr);
                 }
-                global::System.GC.SuppressFinalize(this);
-                base.Dispose();
+                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
             }
+
+            base.Dispose(type);
         }
 
         /// <summary>