diff --git a/src/Libraries/AvalonDock/AvalonDock/DockingManager.cs b/src/Libraries/AvalonDock/AvalonDock/DockingManager.cs index 45a393e3fa..b65cdc147d 100644 --- a/src/Libraries/AvalonDock/AvalonDock/DockingManager.cs +++ b/src/Libraries/AvalonDock/AvalonDock/DockingManager.cs @@ -2636,6 +2636,15 @@ namespace AvalonDock //_flyoutWindow.KeepWindowOpen(); return; } + + // David: This sometimes seems to be null when hovering over auto-hide pad. + // It only seems to occur in specific circumstances - whether the pad is the + // "selected" one in the set seems important. Having no open document might have effect? + // I have only managed to reliablely reproduce it in stand-alone application. + if (content.ContainerPane == null) + { + return; + } //hide previous window HideFlyoutWindow(); diff --git a/src/Libraries/AvalonDock/AvalonDock/DocumentTabPanel.cs b/src/Libraries/AvalonDock/AvalonDock/DocumentTabPanel.cs index b4ed1cf282..86c963cc92 100644 --- a/src/Libraries/AvalonDock/AvalonDock/DocumentTabPanel.cs +++ b/src/Libraries/AvalonDock/AvalonDock/DocumentTabPanel.cs @@ -65,6 +65,10 @@ namespace AvalonDock foreach (ManagedContent child in Children) { + // David: Sometimes happened when closing document tab by middle clicking. Really difficult to reproduce. + if (child == null) + continue; + Panel.SetZIndex(child, Selector.GetIsSelected(child) ? 1 : -i); i++; child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); @@ -81,6 +85,10 @@ namespace AvalonDock bool skipAllOthers = false; foreach (ManagedContent doc in Children) { + // David: Sometimes happened when closing document tab by middle clicking. Really difficult to reproduce. + if (doc == null) + continue; + if (skipAllOthers || offset + doc.DesiredSize.Width > finalSize.Width) { SetIsHeaderVisible(doc, false);