From 09297dbb089110c2c70c675eb4b671d10834ef46 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 9 Jan 2020 10:37:44 +0100 Subject: [PATCH] Fix repeater holding onto elements If a consumer changes the ItemsSource with a non recycling layout then the items from the old source would be perpetually held by repeater, a potentially substantial leak. Ported from https://github.com/microsoft/microsoft-ui-xaml/commit/e158eec3e93f7c3839f5a9e5226f0f4e0103f2a6 --- src/Avalonia.Controls/Repeater/ItemsRepeater.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Avalonia.Controls/Repeater/ItemsRepeater.cs b/src/Avalonia.Controls/Repeater/ItemsRepeater.cs index 0e2136a6f3..685d3e44f2 100644 --- a/src/Avalonia.Controls/Repeater/ItemsRepeater.cs +++ b/src/Avalonia.Controls/Repeater/ItemsRepeater.cs @@ -588,6 +588,8 @@ namespace Avalonia.Controls ClearElementImpl(element); } } + + Children.Clear(); } InvalidateMeasure();