[NUI] Fix some SVACE issues.
authorzhouhao02 <haozhou.zhou@samsung.com>
Wed, 30 Aug 2023 01:39:56 +0000 (09:39 +0800)
committerEunki Hong <h.pichulia@gmail.com>
Tue, 5 Sep 2023 13:41:07 +0000 (22:41 +0900)
src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs
src/Tizen.NUI.Components/Controls/SliderBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs

index 52adc96cba952b6c0b096d074655a9ebf0a5a57b..9d54cd21fec12253af30418262c7822c351a631c 100755 (executable)
@@ -1321,7 +1321,8 @@ namespace Tizen.NUI.Components
 
         private void ReinitializeLayout()
         {
-            if (ItemsSource == null || ItemsLayouter == null || ItemTemplate == null)
+            var localItemsLayouter = ItemsLayouter;
+            if (ItemsSource == null || localItemsLayouter == null || ItemTemplate == null)
             {
                 return;
             }
@@ -1349,11 +1350,11 @@ namespace Tizen.NUI.Components
                 itemsLayouter.Clear();
                 ClearCache();
 
-                ItemsLayouter.Initialize(this);
+                localItemsLayouter.Initialize(this);
                 needInitalizeLayouter = false;
             }
 
-            ItemsLayouter.RequestLayout(0.0f, true);
+            localItemsLayouter.RequestLayout(0.0f, true);
 
             if (delayedScrollTo)
             {
@@ -1369,11 +1370,11 @@ namespace Tizen.NUI.Components
 
             if (ScrollingDirection == Direction.Horizontal)
             {
-                ContentContainer.SizeWidth = (float)ItemsLayouter?.CalculateLayoutOrientationSize();
+                ContentContainer.SizeWidth = (float)localItemsLayouter.CalculateLayoutOrientationSize();
             }
             else
             {
-                ContentContainer.SizeHeight = (float)ItemsLayouter?.CalculateLayoutOrientationSize();
+                ContentContainer.SizeHeight = (float)localItemsLayouter.CalculateLayoutOrientationSize();
             }
         }
 
index d11c2a5ce794ba0a1329169ce724d6bf03e26e9d..ec36b198bfd42de9868112ca4385f5c810230113 100755 (executable)
@@ -352,9 +352,9 @@ namespace Tizen.NUI.Components
         public static readonly BindableProperty LowIndicatorSizeProperty = BindableProperty.Create(nameof(LowIndicatorSize), typeof(Size), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (Slider)bindable;
-            if (newValue != null)
+            if (newValue as Size is var nVal && nVal != null)
             {
-                instance.InternalLowIndicatorSize = newValue as Size;
+                instance.InternalLowIndicatorSize = nVal;
             }
         },
         defaultValueCreator: (bindable) =>
@@ -370,9 +370,9 @@ namespace Tizen.NUI.Components
         public static readonly BindableProperty HighIndicatorSizeProperty = BindableProperty.Create(nameof(HighIndicatorSize), typeof(Size), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (Slider)bindable;
-            if (newValue != null)
+            if (newValue as Size is var nVal && nVal != null)
             {
-                instance.InternalHighIndicatorSize = newValue as Size;
+                instance.InternalHighIndicatorSize = nVal;
             }
         },
         defaultValueCreator: (bindable) =>
@@ -388,9 +388,9 @@ namespace Tizen.NUI.Components
         public static readonly BindableProperty ValueIndicatorSizeProperty = BindableProperty.Create(nameof(ValueIndicatorSize), typeof(Size), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (Slider)bindable;
-            if (newValue != null)
+            if (newValue as Size is var nVal && nVal != null)
             {
-                instance.InternalValueIndicatorSize = newValue as Size;
+                instance.InternalValueIndicatorSize = nVal;
             }
         },
         defaultValueCreator: (bindable) =>
index cf4892ce29d3ec17bb0c4cff12c97e12f17d7d3e..f7951915372161ba0b08f1d9bbdece74f292d4dc 100755 (executable)
@@ -719,13 +719,14 @@ namespace Tizen.NUI.BaseComponents
                 {
                     if (this.IsDisposeQueued)
                     {
-                        var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
+                        using var process = global::System.Diagnostics.Process.GetCurrentProcess();
+                        var processId = process.Id;
                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
                         var me = this.GetType().FullName;
 
                         //in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked!
                         Tizen.Log.Error("NUI", "in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked! just return here! \n" +
-                            $"process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
+                            $"process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
                         return;
                     }
                 }
@@ -742,26 +743,28 @@ namespace Tizen.NUI.BaseComponents
                 {
                     if (keyInputFocusLostEventHandler != null)
                     {
-                        var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
+                        using var process = global::System.Diagnostics.Process.GetCurrentProcess();
+                        var processId = process.Id;
                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
                         var me = this.GetType().FullName;
 
                         throw new ObjectDisposedException(nameof(SwigCPtr), $"Error! NUI's native dali object is already disposed. " +
                             $"OR the native dali object handle of NUI becomes null! \n" +
-                            $" process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
+                            $" process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
                     }
                 }
                 else
                 {
                     if (this.IsDisposeQueued)
                     {
-                        var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
+                        using var process = global::System.Diagnostics.Process.GetCurrentProcess();
+                        var processId = process.Id;
                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
                         var me = this.GetType().FullName;
 
                         //in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked!
                         Tizen.Log.Error("NUI", "in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked! just return here! \n" +
-                            $"process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
+                            $"process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
                         return;
                     }
                 }