Browse Source

Teaks and remove copy-pasta.

pull/4626/head
Steven Kirk 6 years ago
parent
commit
e579e61f38
  1. 8
      src/Avalonia.Controls/Repeater/ItemsRepeater.cs
  2. 5
      tests/Avalonia.LeakTests/ControlTests.cs

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

@ -684,11 +684,11 @@ namespace Avalonia.Controls
WeakEventHandlerManager.Unsubscribe<EventArgs, ItemsRepeater>( WeakEventHandlerManager.Unsubscribe<EventArgs, ItemsRepeater>(
oldValue, oldValue,
nameof(newValue.MeasureInvalidated), nameof(AttachedLayout.MeasureInvalidated),
InvalidateMeasureForLayout); InvalidateMeasureForLayout);
WeakEventHandlerManager.Unsubscribe<EventArgs, ItemsRepeater>( WeakEventHandlerManager.Unsubscribe<EventArgs, ItemsRepeater>(
oldValue, oldValue,
nameof(newValue.ArrangeInvalidated), nameof(AttachedLayout.ArrangeInvalidated),
InvalidateArrangeForLayout); InvalidateArrangeForLayout);
// Walk through all the elements and make sure they are cleared // Walk through all the elements and make sure they are cleared
@ -709,11 +709,11 @@ namespace Avalonia.Controls
WeakEventHandlerManager.Subscribe<AttachedLayout, EventArgs, ItemsRepeater>( WeakEventHandlerManager.Subscribe<AttachedLayout, EventArgs, ItemsRepeater>(
newValue, newValue,
nameof(newValue.MeasureInvalidated), nameof(AttachedLayout.MeasureInvalidated),
InvalidateMeasureForLayout); InvalidateMeasureForLayout);
WeakEventHandlerManager.Subscribe<AttachedLayout, EventArgs, ItemsRepeater>( WeakEventHandlerManager.Subscribe<AttachedLayout, EventArgs, ItemsRepeater>(
newValue, newValue,
nameof(newValue.ArrangeInvalidated), nameof(AttachedLayout.ArrangeInvalidated),
InvalidateArrangeForLayout); InvalidateArrangeForLayout);
} }

5
tests/Avalonia.LeakTests/ControlTests.cs

@ -557,8 +557,6 @@ namespace Avalonia.LeakTests
{ {
using (Start()) using (Start())
{ {
var geometry = new EllipseGeometry { Rect = new Rect(0, 0, 10, 10) };
Func<Window> run = () => Func<Window> run = () =>
{ {
var window = new Window var window = new Window
@ -582,9 +580,6 @@ namespace Avalonia.LeakTests
dotMemory.Check(memory => dotMemory.Check(memory =>
Assert.Equal(0, memory.GetObjects(where => where.Type.Is<ItemsRepeater>()).ObjectsCount)); Assert.Equal(0, memory.GetObjects(where => where.Type.Is<ItemsRepeater>()).ObjectsCount));
// We are keeping geometry alive to simulate a resource that outlives the control.
GC.KeepAlive(geometry);
} }
} }

Loading…
Cancel
Save