Browse Source

Don't dispose completed binding.

pull/1885/head
Steven Kirk 8 years ago
parent
commit
f2f96e2f46
  1. 7
      src/Avalonia.Base/PriorityBindingEntry.cs
  2. 14
      src/Avalonia.Base/PriorityLevel.cs

7
src/Avalonia.Base/PriorityBindingEntry.cs

@ -50,6 +50,11 @@ namespace Avalonia
get; get;
} }
/// <summary>
/// Gets a value indicating whether the binding has completed.
/// </summary>
public bool HasCompleted { get; private set; }
/// <summary> /// <summary>
/// The current value of the binding. /// The current value of the binding.
/// </summary> /// </summary>
@ -129,6 +134,8 @@ namespace Avalonia
private void Completed() private void Completed()
{ {
HasCompleted = true;
if (Dispatcher.UIThread.CheckAccess()) if (Dispatcher.UIThread.CheckAccess())
{ {
_owner.Completed(this); _owner.Completed(this);

14
src/Avalonia.Base/PriorityLevel.cs

@ -112,12 +112,16 @@ namespace Avalonia
return Disposable.Create(() => return Disposable.Create(() =>
{ {
Bindings.Remove(node); if (!entry.HasCompleted)
entry.Dispose();
if (entry.Index >= ActiveBindingIndex)
{ {
ActivateFirstBinding(); Bindings.Remove(node);
entry.Dispose();
if (entry.Index >= ActiveBindingIndex)
{
ActivateFirstBinding();
}
} }
}); });
} }

Loading…
Cancel
Save