Skip to content

Commit

Permalink
Merge pull request #3294 from tom-englert/dev/WpfRefactoring
Browse files Browse the repository at this point in the history
Fix possible ObservableCollection re-entrance crash when trying to na…
  • Loading branch information
siegfriedpammer authored Sep 28, 2024
2 parents c524892 + 9b95f92 commit 64cbcd4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ILSpy/AssemblyTree/AssemblyTreeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,14 +530,22 @@ internal void SelectNodes(IEnumerable<SharpTreeNode> nodes)
if (this.isNavigatingHistory)
{
SelectedItems.Clear();
SelectedItems.AddRange(nodesList);
foreach (var node in nodesList)
{
activeView.ScrollIntoView(node);
SelectedItems.Add(node);
}
}
else
{
// defer selection change, so it does not interfere with the focus of the tab page.
Dispatcher.BeginInvoke(() => {
SelectedItems.Clear();
SelectedItems.AddRange(nodesList);
foreach (var node in nodesList)
{
activeView.ScrollIntoView(node);
SelectedItems.Add(node);
}
});
}
}
Expand Down Expand Up @@ -691,6 +699,7 @@ public void LoadAssemblies(IEnumerable<string> fileNames, List<LoadedAssembly> l
if (node != null && focusNode)
{
lastNode = node;
activeView?.ScrollIntoView(node);
SelectedItems.Add(node);
}
}
Expand Down

0 comments on commit 64cbcd4

Please sign in to comment.