Skip to content

Commit

Permalink
Fix possible ObservableCollection re-entrance crash when trying to na…
Browse files Browse the repository at this point in the history
…vigate to a collapsed item.
  • Loading branch information
tom-englert committed Sep 28, 2024
1 parent c524892 commit 9b95f92
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 9b95f92

Please sign in to comment.