Skip to content

Commit

Permalink
Merge pull request #425 from Khaos66/master
Browse files Browse the repository at this point in the history
Fix: Potential NRE on app close
  • Loading branch information
Dirkster99 committed Mar 24, 2023
2 parents 5d14c0e + 324effd commit 35ca486
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions source/Components/AvalonDock/DockingManager.cs
Expand Up @@ -1138,7 +1138,7 @@ public double GridSplitterHeight
new FrameworkPropertyMetadata((Style)null));

/// <summary>
/// Gets or sets the GridSplitterVerticalStyle property. This dependency property
/// Gets or sets the GridSplitterVerticalStyle property. This dependency property
/// indicates the style to apply to the LayoutGridResizerControl when displayed vertically.
/// </summary>
public Style GridSplitterVerticalStyle
Expand All @@ -1164,7 +1164,7 @@ public Style GridSplitterVerticalStyle
new FrameworkPropertyMetadata((Style)null));

/// <summary>
/// Gets or sets the GridSplitterHorizontalStyle property. This dependency property
/// Gets or sets the GridSplitterHorizontalStyle property. This dependency property
/// indicates the style to apply to the LayoutGridResizerControl when displayed horizontally.
/// </summary>
public Style GridSplitterHorizontalStyle
Expand Down Expand Up @@ -2125,9 +2125,8 @@ private void DockingManager_Loaded(object sender, RoutedEventArgs e)
}
_fwHiddenList.Clear();

// load floating windows not already loaded! (issue #59 & #254)
var items = new List<LayoutFloatingWindow>(Layout.FloatingWindows.Where(fw => !_fwList.Any(fwc => fwc.Model == fw)));
foreach (var fw in items)
// load floating windows not already loaded! (issue #59 & #254 & #426)
foreach (var fw in Layout.FloatingWindows.Where(fw => !_fwList.Any(fwc => fwc.Model == fw)))
CreateUIElementForModel(fw);

//create the overlaywindow if it's possible
Expand Down Expand Up @@ -2292,7 +2291,7 @@ private void DocumentsSourceElementsChanged(object sender, NotifyCollectionChang
foreach (var documentToRemove in documentsToRemove)
{
documentToRemove.Content = null;
documentToRemove.Parent.RemoveChild(documentToRemove);
documentToRemove.Parent?.RemoveChild(documentToRemove);
RemoveViewFromLogicalChild(documentToRemove);
}
}
Expand Down Expand Up @@ -2354,7 +2353,7 @@ private void DocumentsSourceElementsChanged(object sender, NotifyCollectionChang
var documentsToRemove = GetItemsToRemoveAfterReset<LayoutDocument>(DocumentsSource);
foreach (var documentToRemove in documentsToRemove)
{
(documentToRemove.Parent as ILayoutContainer).RemoveChild(
(documentToRemove.Parent as ILayoutContainer)?.RemoveChild(
documentToRemove);
RemoveViewFromLogicalChild(documentToRemove);
}
Expand Down

0 comments on commit 35ca486

Please sign in to comment.