[NUI] Fix Window.Dispose and Layer.LayoutCount
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Mon, 25 Apr 2022 08:28:49 +0000 (17:28 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 26 Apr 2022 04:41:13 +0000 (13:41 +0900)
Since Layer.Dispose updates LayoutController.LayoutCount,
LayoutController.Dispose should be called after all layers' Dispose are
called in Window.Dispose.

When a layer's LayoutCount is set, it should update its
LayoutController.LayoutCount by the difference between new and current
LayoutCount.

src/Tizen.NUI/src/public/Common/Layer.cs
src/Tizen.NUI/src/public/Window/Window.cs

index fa78077..4b56f75 100755 (executable)
@@ -763,15 +763,8 @@ namespace Tizen.NUI
 
                 if (window != null)
                 {
-                    if (value == 0)
-                    {
-                        window.LayoutController.LayoutCount = 0;
-                    }
-                    else
-                    {
-                        int diff = value - layoutCount;
-                        window.LayoutController.LayoutCount += diff;
-                    }
+                    int diff = value - layoutCount;
+                    window.LayoutController.LayoutCount += diff;
                 }
                 layoutCount = value;
             }
index 3436578..4ef9685 100644 (file)
@@ -1743,13 +1743,6 @@ namespace Tizen.NUI
                     DisposeBorder();
                 }
 
-                if (rootLayer != null)
-                {
-                    rootLayer.Dispose();
-                }
-
-                localController?.Dispose();
-
                 foreach (var layer in childLayers)
                 {
                     if (layer != null)
@@ -1759,6 +1752,8 @@ namespace Tizen.NUI
                 }
 
                 childLayers.Clear();
+
+                localController?.Dispose();
             }
 
             this.DisconnectNativeSignals();