@ -797,6 +797,12 @@ namespace Avalonia.PropertyStore
{
{
var frame = _f rames [ i ] ;
var frame = _f rames [ i ] ;
var priority = frame . Priority ;
var priority = frame . Priority ;
// Exit early if the current EffectiveValue has higher priority than this frame.
if ( current ? . Priority < priority & & current ? . BasePriority < priority )
break ;
// Try to get an entry from the frame for the property we're reevaluating.
var foundEntry = frame . TryGetEntryIfActive ( property , out var entry , out var activeChanged ) ;
var foundEntry = frame . TryGetEntryIfActive ( property , out var entry , out var activeChanged ) ;
// If the active state of the frame has changed since the last read, and
// If the active state of the frame has changed since the last read, and
@ -808,9 +814,13 @@ namespace Avalonia.PropertyStore
return ;
return ;
}
}
var isRelevantPriority = HasHigherPriority ( entry ! , priority , current , changedValueEntry ) ;
// If the frame has an entry for this property with a higher priority than the
// current effective value (and that entry has a value), then we have a new
if ( foundEntry & & isRelevantPriority & & entry ! . HasValue )
// value for the property. Note that the check for entry.HasValue must be
// evaluated last as it can cause bindings to be subscribed.
if ( foundEntry & &
HasHigherPriority ( entry ! , priority , current , changedValueEntry ) & &
entry ! . HasValue )
{
{
if ( current is not null )
if ( current is not null )
{
{
@ -826,10 +836,6 @@ namespace Avalonia.PropertyStore
if ( generation ! = _f rameGeneration )
if ( generation ! = _f rameGeneration )
goto restart ;
goto restart ;
if ( current ? . Priority < BindingPriority . Unset & &
current ? . BasePriority < BindingPriority . Unset )
break ;
}
}
if ( current ? . Priority = = BindingPriority . Unset )
if ( current ? . Priority = = BindingPriority . Unset )