[NUI] Fix Layout Performance Issue (#3484)
authorhuiyu <35286162+huiyueun@users.noreply.github.com>
Wed, 1 Sep 2021 06:35:02 +0000 (15:35 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 1 Sep 2021 08:20:01 +0000 (17:20 +0900)
Layout Process should be registered only once.

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/internal/Layouting/LayoutController.cs

index 9a7a15e..6405494 100755 (executable)
@@ -36,7 +36,7 @@ namespace Tizen.NUI
         private List<LayoutData> layoutTransitionDataQueue;
         private List<LayoutItem> itemRemovalQueue;
 
-        private ProcessorController.ProcessorEventHandler LayoutProcessorCallback = null;
+        private bool subscribed;
 
         /// <summary>
         /// Constructs a LayoutController which controls the measuring and layouting.<br />
@@ -122,9 +122,10 @@ namespace Tizen.NUI
         /// </summary>
         internal void CreateProcessCallback()
         {
-            if (LayoutProcessorCallback == null)
+            if (!subscribed)
             {
                 ProcessorController.Instance.LayoutProcessorEvent += Process;
+                subscribed = true;
             }
         }
 
@@ -160,10 +161,10 @@ namespace Tizen.NUI
                 return;
             }
 
-            if (LayoutProcessorCallback != null)
+            if (subscribed)
             {
                 ProcessorController.Instance.LayoutProcessorEvent -= Process;
-                LayoutProcessorCallback = null;
+                subscribed = false;
             }
 
             //Release your own unmanaged resources here.