[NUI] Add AliveCount property to get currently alived View number
authordongsug.song <dongsug.song@samsung.com>
Tue, 14 Nov 2023 13:14:33 +0000 (22:14 +0900)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Wed, 15 Nov 2023 08:56:46 +0000 (17:56 +0900)
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs

index 601d553875603fa74a44adacb1c60663b3d477fa..947edadd09d97a188acb4eea9fb3c92dd3253fe2 100755 (executable)
@@ -85,6 +85,8 @@ namespace Tizen.NUI.BaseComponents
         private Vector4 internalCurrentWorldColor = null;
         private Vector2 internalCurrentScreenPosition = null;
 
+        private static int aliveCount = 0;
+
         static View()
         {
             RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
@@ -208,6 +210,8 @@ namespace Tizen.NUI.BaseComponents
             {
                 SetVisible(false);
             }
+
+            aliveCount++;
         }
 
         internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
@@ -3496,5 +3500,11 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Vector3 CurrentScale => GetCurrentScale();
 
+        /// <summary>
+        /// Gets the number of currently alived View object.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static int AliveCount => aliveCount;
+
     }
 }
index eabb6661fb761b3b9a6a830fea176d76678b8abe..bb0449c827e53e8dd57c97b0fa1e20d08bafb96c 100755 (executable)
@@ -403,6 +403,7 @@ namespace Tizen.NUI.BaseComponents
                 {
                     // at this case, implicit nor explicit dispose is not required. No native object is made.
                     disposed = true;
+                    aliveCount--;
                     return;
                 }
             }
index 9e68a77105c59639cb3b7561e3ce4bbcb2534802..47b4dec2521d16d1d0c8502976528877be45361a 100755 (executable)
@@ -1468,6 +1468,8 @@ namespace Tizen.NUI.BaseComponents
             NUILog.Debug($"=============================");
 
             base.Dispose(type);
+            
+            aliveCount--;
         }
 
         /// This will not be public opened.