瀏覽代碼

Don't dispose completed binding.

Steven Kirk 7 年之前
父節點
當前提交
f2f96e2f46
共有 2 個文件被更改,包括 16 次插入5 次删除
  1. 7 0
      src/Avalonia.Base/PriorityBindingEntry.cs
  2. 9 5
      src/Avalonia.Base/PriorityLevel.cs

+ 7 - 0
src/Avalonia.Base/PriorityBindingEntry.cs

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

+ 9 - 5
src/Avalonia.Base/PriorityLevel.cs

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