Browse Source

Checking _operation for null isn't enough.

Instead check if `UpdateCount` is not 0 to allow recursive setting of `Source`.

I have a vague feeling that this isn't actually the correct solution, and that more issues are going to arise around this scenario but for now I'm unable to create a failing test so let's go with the simple solution for now.

Fixes #11617
pull/11782/head
Steven Kirk 3 years ago
parent
commit
1dc19f1627
  1. 2
      src/Avalonia.Controls/Selection/SelectionModel.cs

2
src/Avalonia.Controls/Selection/SelectionModel.cs

@ -277,7 +277,7 @@ namespace Avalonia.Controls.Selection
{
if (base.Source != value)
{
if (_operation is not null)
if (_operation?.UpdateCount > 0)
{
throw new InvalidOperationException("Cannot change source while update is in progress.");
}

Loading…
Cancel
Save