diff --git a/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs b/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs index 08c95a44..5aeb512b 100644 --- a/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs +++ b/source/Components/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs @@ -195,7 +195,13 @@ protected override void OnMouseEnter( MouseEventArgs e ) return; var childrenList = container.Children.ToList(); - containerPane.MoveChild( childrenList.IndexOf( _draggingItem.Model ), childrenList.IndexOf( model ) ); + + // Hotfix to avoid crash caused by a likely threading issue Back in the containerPane. + var oldIndex = childrenList.IndexOf( _draggingItem.Model ); + var newIndex = childrenList.IndexOf( model ); + + if (newIndex < containerPane.ChildrenCount && oldIndex > -1) + containerPane.MoveChild( oldIndex, newIndex ); } }