From 8d5f26de77c362e791a9f075d20e6eded61c89ae Mon Sep 17 00:00:00 2001 From: "sung-su.kim" Date: Tue, 4 Feb 2020 20:30:37 +0900 Subject: [PATCH] Fix 8586 8587 - [Tizen] Added guard for CollectionView (#9367) fixes #8586 #8587 * [Tizen] Remove events on unbinding in CollectionView - Resolves bug #8587 * [Tizen] Guard for sizeless layout requests in CollectionView - Resolves bug #8586 --- .../Native/CollectionView/CollectionView.cs | 3 +++ .../Native/CollectionView/GridLayoutManager.cs | 3 +++ .../Native/CollectionView/ItemTemplateAdaptor.cs | 4 ++-- .../Native/CollectionView/LinearLayoutManager.cs | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Xamarin.Forms.Platform.Tizen/Native/CollectionView/CollectionView.cs b/Xamarin.Forms.Platform.Tizen/Native/CollectionView/CollectionView.cs index 6824cc182..b507f5250 100644 --- a/Xamarin.Forms.Platform.Tizen/Native/CollectionView/CollectionView.cs +++ b/Xamarin.Forms.Platform.Tizen/Native/CollectionView/CollectionView.cs @@ -495,6 +495,9 @@ namespace Xamarin.Forms.Platform.Tizen.Native void RequestLayoutItems() { + if (AllocatedSize.Width <= 0 || AllocatedSize.Height <= 0) + return; + if (!_requestLayoutItems) { _requestLayoutItems = true; diff --git a/Xamarin.Forms.Platform.Tizen/Native/CollectionView/GridLayoutManager.cs b/Xamarin.Forms.Platform.Tizen/Native/CollectionView/GridLayoutManager.cs index 2ac17e25c..10359c9b3 100644 --- a/Xamarin.Forms.Platform.Tizen/Native/CollectionView/GridLayoutManager.cs +++ b/Xamarin.Forms.Platform.Tizen/Native/CollectionView/GridLayoutManager.cs @@ -115,6 +115,9 @@ namespace Xamarin.Forms.Platform.Tizen.Native public void LayoutItems(Rect bound, bool force) { + if (_allocatedSize.Width <= 0 || _allocatedSize.Height <= 0) + return; + // TODO : need to optimization. it was frequently called with similar bound value. if (!ShouldRearrange(bound) && !force) { diff --git a/Xamarin.Forms.Platform.Tizen/Native/CollectionView/ItemTemplateAdaptor.cs b/Xamarin.Forms.Platform.Tizen/Native/CollectionView/ItemTemplateAdaptor.cs index a03ea3935..bb0f61511 100644 --- a/Xamarin.Forms.Platform.Tizen/Native/CollectionView/ItemTemplateAdaptor.cs +++ b/Xamarin.Forms.Platform.Tizen/Native/CollectionView/ItemTemplateAdaptor.cs @@ -104,9 +104,9 @@ namespace Xamarin.Forms.Platform.Tizen.Native public override void RemoveNativeView(EvasObject native) { + UnBinding(native); if (_nativeFormsTable.TryGetValue(native, out View view)) { - ResetBindedView(view); Platform.GetRenderer(view)?.Dispose(); _nativeFormsTable.Remove(native); } @@ -178,7 +178,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native int index = GetItemIndex(data); if (index != -1) { - CollectionView.ItemMeasureInvalidated(index); + CollectionView?.ItemMeasureInvalidated(index); } } } diff --git a/Xamarin.Forms.Platform.Tizen/Native/CollectionView/LinearLayoutManager.cs b/Xamarin.Forms.Platform.Tizen/Native/CollectionView/LinearLayoutManager.cs index b13834fbd..012404df2 100644 --- a/Xamarin.Forms.Platform.Tizen/Native/CollectionView/LinearLayoutManager.cs +++ b/Xamarin.Forms.Platform.Tizen/Native/CollectionView/LinearLayoutManager.cs @@ -110,6 +110,9 @@ namespace Xamarin.Forms.Platform.Tizen.Native public void LayoutItems(Rect bound, bool force) { + if (_allocatedSize.Width <= 0 || _allocatedSize.Height <= 0) + return; + // TODO : need to optimization. it was frequently called with similar bound value. if (!ShouldRearrange(bound) && !force) {