Browse Source

Teaks and remove copy-pasta.

Steven Kirk 5 years ago
parent
commit
e579e61f38

+ 4 - 4
src/Avalonia.Controls/Repeater/ItemsRepeater.cs

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

+ 0 - 5
tests/Avalonia.LeakTests/ControlTests.cs

@@ -557,8 +557,6 @@ namespace Avalonia.LeakTests
         {
             using (Start())
             {
-                var geometry = new EllipseGeometry { Rect = new Rect(0, 0, 10, 10) };
-
                 Func<Window> run = () =>
                 {
                     var window = new Window
@@ -582,9 +580,6 @@ namespace Avalonia.LeakTests
 
                 dotMemory.Check(memory =>
                     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);
             }
         }