From 6ec1e3043f4d393d2e559135fc75608b24bf87d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98=E6=99=93=E9=9D=92?= <569132102@qq.com>
Date: Fri, 3 Jul 2020 13:27:16 +0800
Subject: [PATCH] Fix leaks on close #171
---
.../MainWindow.xaml.cs | 6 +++-
.../AvalonDock.Themes.Aero/Theme.xaml | 7 ++---
.../AvalonDock.Themes.Expression/Theme.xaml | 7 ++---
.../AvalonDock.Themes.Metro/Theme.xaml | 7 ++---
.../AvalonDock.Themes.VS2010/Theme.xaml | 7 ++---
.../Themes/Generic.xaml | 9 ++----
.../Controls/LayoutAutoHideWindowControl.cs | 4 +--
.../Controls/LayoutDocumentPaneControl.cs | 28 +++++++++++++++++--
.../Controls/LayoutDocumentTabItem.cs | 8 ++++--
.../Components/AvalonDock/DockingManager.cs | 2 ++
.../AvalonDock/Layout/LayoutContent.cs | 6 ++++
.../Components/AvalonDock/Themes/generic.xaml | 8 ++----
12 files changed, 63 insertions(+), 36 deletions(-)
diff --git a/source/AvalonDocPanelMemoryLeaks/MainWindow.xaml.cs b/source/AvalonDocPanelMemoryLeaks/MainWindow.xaml.cs
index e83424d5..2689d8b8 100644
--- a/source/AvalonDocPanelMemoryLeaks/MainWindow.xaml.cs
+++ b/source/AvalonDocPanelMemoryLeaks/MainWindow.xaml.cs
@@ -27,10 +27,13 @@ public MainWindow()
InitializeComponent();
}
+ public HeavyLoad HeavyLoad { get; private set; }
+
private void Button_Click(object sender, RoutedEventArgs e)
{
UserControl content = new UserControl();
- content.DataContext = new HeavyLoad();
+ HeavyLoad = new HeavyLoad();
+ content.DataContext = HeavyLoad;
LayoutDocument docDocument = new LayoutDocument();
docDocument.Content = content;
docGrup.Children.Add(docDocument);
@@ -39,6 +42,7 @@ private void Button_Click(object sender, RoutedEventArgs e)
private void DocClosed(object sender, EventArgs e)
{
+ HeavyLoad.Load = null;
GC.Collect();
}
}
diff --git a/source/Components/AvalonDock.Themes.Aero/Theme.xaml b/source/Components/AvalonDock.Themes.Aero/Theme.xaml
index da765898..11455974 100644
--- a/source/Components/AvalonDock.Themes.Aero/Theme.xaml
+++ b/source/Components/AvalonDock.Themes.Aero/Theme.xaml
@@ -1008,6 +1008,8 @@