Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
fix memory leak (and some crashes) in ItemsViewController (iOS)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmijieux committed Jul 6, 2021
1 parent 49a12b3 commit 0d34dee
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Xamarin.Forms.Platform.iOS/CollectionView/ItemsViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ public abstract class ItemsViewController<TItemsView> : UICollectionViewControll
{
public const int EmptyTag = 333;

public IItemsViewSource ItemsSource { get; protected set; }

private IItemsViewSource _itemsSource;
public IItemsViewSource ItemsSource
{
get => _itemsSource;
protected set
{
if (_itemsSource != null && value != _itemsSource)
{
_itemsSource.Dispose();
}
_itemsSource = value;
}
}
public TItemsView ItemsView { get; }
protected ItemsViewLayout ItemsViewLayout { get; set; }
bool _initialized;
Expand Down

0 comments on commit 0d34dee

Please sign in to comment.