Skip to content

Commit

Permalink
Reduced memory alloc for combined binding subjects (#16794)
Browse files Browse the repository at this point in the history
  • Loading branch information
YohDeadfall authored Aug 23, 2024
1 parent 5581516 commit e627821
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Data/InstancedBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static InstancedBinding TwoWay(
_ = observable ?? throw new ArgumentNullException(nameof(observable));
_ = observer ?? throw new ArgumentNullException(nameof(observer));

var subject = new CombinedSubject<object?>(observer, observable);
var subject = observable == observer ? observable : new CombinedSubject<object?>(observer, observable);
return new InstancedBinding(subject, BindingMode.TwoWay, priority);
}

Expand Down

0 comments on commit e627821

Please sign in to comment.