Răsfoiți Sursa

Don't dispose completed binding.

Steven Kirk 7 ani în urmă
părinte
comite
f2f96e2f46

+ 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();
+                    }
                 }
             });
         }