Browse Source

Merge branch 'master' into fix-black-area-inside-window

pull/2211/head
ahopper 7 years ago
committed by GitHub
parent
commit
94f0bb47bb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/Avalonia.Base/Data/Core/ExpressionNode.cs
  2. 13
      tests/Avalonia.Base.UnitTests/Data/Core/ExpressionObserverTests_Property.cs

1
src/Avalonia.Base/Data/Core/ExpressionNode.cs

@ -147,6 +147,7 @@ namespace Avalonia.Data.Core
private void StopListening() private void StopListening()
{ {
StopListeningCore(); StopListeningCore();
_listening = false;
} }
private BindingNotification TargetNullNotification() private BindingNotification TargetNullNotification()

13
tests/Avalonia.Base.UnitTests/Data/Core/ExpressionObserverTests_Property.cs

@ -563,6 +563,19 @@ namespace Avalonia.Base.UnitTests.Data.Core
Assert.Null(result.Item2.Target); Assert.Null(result.Item2.Target);
} }
[Fact]
public void Should_Not_Throw_Exception_On_Unsubscribe_When_Already_Unsubscribed()
{
var source = new Class1 { Foo = "foo" };
var target = new PropertyAccessorNode("Foo", false);
Assert.NotNull(target);
target.Target = new WeakReference(source);
target.Subscribe(_ => { });
target.Unsubscribe();
target.Unsubscribe();
Assert.True(true);
}
private interface INext private interface INext
{ {
int PropertyChangedSubscriptionCount { get; } int PropertyChangedSubscriptionCount { get; }

Loading…
Cancel
Save