Browse Source

Make sure OneTime bindings unsubscribe.

`OneTime` bindings unsubscribe when the first value is pushed, meaning that they unsubscribe _during_ `ExpressionNode.StartListeningCore`. Make sure we handle this by:

- Setting `_listening = true` before calling `StartListeningCore`
- Subscribe to current value in `InpcPropertyAccessorPlugin` before sending current value, because we're unsubscribed when `SendCurrentValue` exits
fixes/2983-onewaytosource-twoway
Steven Kirk 7 years ago
parent
commit
d3f8d08a47
  1. 2
      src/Avalonia.Base/Data/Core/ExpressionNode.cs
  2. 2
      src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs

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

@ -140,8 +140,8 @@ namespace Avalonia.Data.Core
}
else if (target != AvaloniaProperty.UnsetValue)
{
StartListeningCore(_target);
_listening = true;
StartListeningCore(_target);
}
else
{

2
src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs

@ -103,8 +103,8 @@ namespace Avalonia.Data.Core.Plugins
protected override void SubscribeCore()
{
SendCurrentValue();
SubscribeToChanges();
SendCurrentValue();
}
protected override void UnsubscribeCore()

Loading…
Cancel
Save