From 061f01ac3a8f13563d9ac72707ea1da22d11163a Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 1 Nov 2022 11:23:58 +0100 Subject: [PATCH] Prevent exception when removing value. Calling `DisposeAndRaiseUnset` can cause a nested reevaluation of property values. --- src/Avalonia.Base/PropertyStore/ValueStore.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Avalonia.Base/PropertyStore/ValueStore.cs b/src/Avalonia.Base/PropertyStore/ValueStore.cs index 4da24c1414..8d7fae41bf 100644 --- a/src/Avalonia.Base/PropertyStore/ValueStore.cs +++ b/src/Avalonia.Base/PropertyStore/ValueStore.cs @@ -899,6 +899,9 @@ namespace Avalonia.PropertyStore { RemoveEffectiveValue(key, i); e.DisposeAndRaiseUnset(this, key); + + if (i > _effectiveValues.Count) + break; } } }