Memory leak fixed. DocPane was holding reference to the last document. #74

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
Contributor

zdomokos commented Oct 26, 2012

Memory leak fixed. DocPane was holding reference to the last document. This is normally not a problem, however when the document is large, and will not be reused - meaning there will be no another ActiveContent on the particular pane, the memory will never be collected.

Owner

roken commented Oct 26, 2012

Thank you for submitting a pull request, it's great to see participation in this project!

Unfortunately, although the issue is valid, this request cannot be accepted. The first thing to note is that DockPane.m_activeContent should not be manipulated directly. It is set via the ActiveContent property which contains important state validation on the new value.

I believe the correct approach here will be to make sure ValidateActiveContent() is called on the pane when the last item is closed/hidden. The most appropriate place for this call is likely in DockPane.CloseContent() but I will need to verify that.

@ghost ghost assigned roken Oct 26, 2012

My memory leaks fix for 2.5.1RC1:

Index: tags/Release_2.5_RC1/WinFormsUI/Docking/DockContentHandler.cs
===================================================================
--- tags/Release_2.5_RC1/WinFormsUI/Docking/DockContentHandler.cs   (revision 115)
+++ tags/Release_2.5_RC1/WinFormsUI/Docking/DockContentHandler.cs   (working copy)
@@ -39,6 +39,10 @@
            {
                lock(this)
                {
+                 if (Pane != null && Pane.DockPanel != null)
+                 {
+                   Hide();
+                 }
                    DockPanel = null;
                    if (m_autoHideTab != null)
                        m_autoHideTab.Dispose();

@roken roken closed this Jun 19, 2014

This method could be internal.

lextm commented on 4fd234b Sep 6, 2016

Already cherry picked in upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment