From: zhouhao02 Date: Wed, 30 Aug 2023 01:39:56 +0000 (+0800) Subject: [NUI] Fix some SVACE issues. X-Git-Tag: accepted/tizen/unified/20231205.024657~166 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=aa3d0903dbfb96c2efbe83a5b7a1c00f00795597;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Fix some SVACE issues. --- diff --git a/src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs b/src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs index 52adc96..9d54cd2 100755 --- a/src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs +++ b/src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs @@ -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(); } } diff --git a/src/Tizen.NUI.Components/Controls/SliderBindableProperty.cs b/src/Tizen.NUI.Components/Controls/SliderBindableProperty.cs index d11c2a5..ec36b19 100755 --- a/src/Tizen.NUI.Components/Controls/SliderBindableProperty.cs +++ b/src/Tizen.NUI.Components/Controls/SliderBindableProperty.cs @@ -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) => diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs index cf4892c..f795191 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs @@ -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; } }