这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions source/Components/AvalonDock/DockingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ This program is provided to you under the terms of the Microsoft Public

namespace AvalonDock
{
/// <inheritdoc cref="Control"/>
/// <inheritdoc cref="IOverlayWindowHost"/>
/// <summary>
/// The <see cref="DockingManager"/> is the custom control at the root of the visual tree.
/// This control is the core control of AvalonDock.
/// It contains core dependency properties, events, and methods to customize and
/// manage many aspects of the docking framework.
/// </summary>
/// <seealso cref="Control"/>
/// <seealso cref="IOverlayWindowHost"/>
[ContentProperty(nameof(Layout))]
/// <inheritdoc cref="Control"/>
/// <inheritdoc cref="IOverlayWindowHost"/>
/// <summary>
/// The <see cref="DockingManager"/> is the custom control at the root of the visual tree.
/// This control is the core control of AvalonDock.
/// It contains core dependency properties, events, and methods to customize and
/// manage many aspects of the docking framework.
/// </summary>
/// <seealso cref="Control"/>
/// <seealso cref="IOverlayWindowHost"/>
[ContentProperty(nameof(Layout))]
[TemplatePart(Name = "PART_AutoHideArea")]
public class DockingManager : Control, IOverlayWindowHost//, ILogicalChildrenContainer
{
Expand Down Expand Up @@ -1731,6 +1731,9 @@ internal void ExecuteCloseCommand(LayoutDocument document)
RemoveLogicalChild(uIElement);
DocumentClosed?.Invoke(this, new DocumentClosedEventArgs(document));

//get rid of the closed document content
document.Content = null;

int indexOfDocumentToSelect = indexOfDocumentToRemove - 1;

if (indexOfDocumentToSelect < 0)
Expand Down Expand Up @@ -2198,9 +2201,9 @@ private TLayoutType[] GetItemsToRemoveAfterReset<TLayoutType>(IEnumerable source
var itemsThatRemain = new HashSet<object>(source.Cast<object>(), ReferenceEqualityComparer.Default);
//Find the removed items that are not in the remaining collection
return Layout.Descendents()
.OfType<TLayoutType>()
.Where(x => !itemsThatRemain.Contains(x.Content))
.ToArray();
.OfType<TLayoutType>()
.Where(x => !itemsThatRemain.Contains(x.Content))
.ToArray();
}

private void DetachDocumentsSource(LayoutRoot layout, IEnumerable documentsSource)
Expand Down
3 changes: 1 addition & 2 deletions source/Components/AvalonDock/Layout/LayoutContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,7 @@ internal void CloseInternal()
}

parentAsContainer.RemoveChild(this);
root?.CollectGarbage();
this.Content = null;
root?.CollectGarbage();
OnClosed();
}

Expand Down