|
|
@ -71,6 +71,28 @@ namespace Avalonia.LeakTests |
|
|
Assert.Equal(0, memory.GetObjects(where => where.Type.Is<NonIntegerIndexer>()).ObjectsCount)); |
|
|
Assert.Equal(0, memory.GetObjects(where => where.Type.Is<NonIntegerIndexer>()).ObjectsCount)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
public void Should_Not_Keep_Source_Alive_MethodBinding() |
|
|
|
|
|
{ |
|
|
|
|
|
Func<ExpressionObserver> run = () => |
|
|
|
|
|
{ |
|
|
|
|
|
var source = new { Foo = new MethodBound() }; |
|
|
|
|
|
var target = new ExpressionObserver(source, "Foo.A"); |
|
|
|
|
|
target.Subscribe(_ => { }); |
|
|
|
|
|
return target; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var result = run(); |
|
|
|
|
|
|
|
|
|
|
|
dotMemory.Check(memory => |
|
|
|
|
|
Assert.Equal(0, memory.GetObjects(where => where.Type.Is<MethodBound>()).ObjectsCount)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private class MethodBound |
|
|
|
|
|
{ |
|
|
|
|
|
public void A() { } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private class NonIntegerIndexer : NotifyingBase |
|
|
private class NonIntegerIndexer : NotifyingBase |
|
|
{ |
|
|
{ |
|
|
private readonly Dictionary<string, string> _storage = new Dictionary<string, string>(); |
|
|
private readonly Dictionary<string, string> _storage = new Dictionary<string, string>(); |
|
|
|