Browse Source

Unsubscribe from ItemsSourceView before disposing it.

pull/6732/head
Steven Kirk 5 years ago
parent
commit
e2a8b56aad
  1. 6
      src/Avalonia.Controls/Repeater/ItemsRepeater.cs

6
src/Avalonia.Controls/Repeater/ItemsRepeater.cs

@ -588,14 +588,14 @@ namespace Avalonia.Controls
throw new AvaloniaInternalException("Cannot set ItemsSourceView during layout."); throw new AvaloniaInternalException("Cannot set ItemsSourceView during layout.");
} }
ItemsSourceView?.Dispose();
ItemsSourceView = newValue;
if (oldValue != null) if (oldValue != null)
{ {
oldValue.CollectionChanged -= OnItemsSourceViewChanged; oldValue.CollectionChanged -= OnItemsSourceViewChanged;
} }
ItemsSourceView?.Dispose();
ItemsSourceView = newValue;
if (newValue != null) if (newValue != null)
{ {
newValue.CollectionChanged += OnItemsSourceViewChanged; newValue.CollectionChanged += OnItemsSourceViewChanged;

Loading…
Cancel
Save