Skip to content

Commit

Permalink
Unsubscribe from ItemsSourceView before disposing it.
Browse files Browse the repository at this point in the history
  • Loading branch information
grokys committed Oct 15, 2021
1 parent 4e65b02 commit e2a8b56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Avalonia.Controls/Repeater/ItemsRepeater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -588,14 +588,14 @@ private void OnDataSourcePropertyChanged(ItemsSourceView oldValue, ItemsSourceVi
throw new AvaloniaInternalException("Cannot set ItemsSourceView during layout.");
}

ItemsSourceView?.Dispose();
ItemsSourceView = newValue;

if (oldValue != null)
{
oldValue.CollectionChanged -= OnItemsSourceViewChanged;
}

ItemsSourceView?.Dispose();
ItemsSourceView = newValue;

if (newValue != null)
{
newValue.CollectionChanged += OnItemsSourceViewChanged;
Expand Down

0 comments on commit e2a8b56

Please sign in to comment.