Browse Source
Merge pull request #8167 from workgroupengineering/fixes/GH-8155
fix(ExpressionNode): ensure _subscriber do not change during ValueChanged
pull/8172/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
23 additions and
23 deletions
-
src/Avalonia.Base/Data/Core/ExpressionNode.cs
|
|
|
@ -98,36 +98,36 @@ namespace Avalonia.Data.Core |
|
|
|
|
|
|
|
private void ValueChanged(object? value, bool notify) |
|
|
|
{ |
|
|
|
if (_subscriber is null) |
|
|
|
return; |
|
|
|
|
|
|
|
var notification = value as BindingNotification; |
|
|
|
|
|
|
|
if (notification == null) |
|
|
|
if (_subscriber is { } subscriber) |
|
|
|
{ |
|
|
|
LastValue = value != null ? new WeakReference<object?>(value) : NullReference; |
|
|
|
var notification = value as BindingNotification; |
|
|
|
var next = Next; |
|
|
|
|
|
|
|
if (Next != null) |
|
|
|
if (notification == null) |
|
|
|
{ |
|
|
|
Next.Target = LastValue; |
|
|
|
LastValue = value != null ? new WeakReference<object?>(value) : NullReference; |
|
|
|
if (next != null) |
|
|
|
{ |
|
|
|
next.Target = LastValue; |
|
|
|
} |
|
|
|
else if (notify) |
|
|
|
{ |
|
|
|
subscriber(value); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (notify) |
|
|
|
else |
|
|
|
{ |
|
|
|
_subscriber(value); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
LastValue = notification.Value != null ? new WeakReference<object?>(notification.Value) : NullReference; |
|
|
|
LastValue = notification.Value != null ? new WeakReference<object?>(notification.Value) : NullReference; |
|
|
|
|
|
|
|
if (Next != null) |
|
|
|
{ |
|
|
|
Next.Target = LastValue; |
|
|
|
} |
|
|
|
if (next != null) |
|
|
|
{ |
|
|
|
next.Target = LastValue; |
|
|
|
} |
|
|
|
|
|
|
|
if (Next == null || notification.Error != null) |
|
|
|
{ |
|
|
|
_subscriber(value); |
|
|
|
if (next == null || notification.Error != null) |
|
|
|
{ |
|
|
|
subscriber(value); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|