From 05bf67df1e65ebb06e8d47298305bb220bcfc3ba Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 May 2020 20:17:31 +0200 Subject: [PATCH] Fix parent/child relationship in MSW wxFindReplaceDialog It's not enough to set the parent pointer in the child, the parent also needs to be aware of its child, so call AddChild() to do both at once. This ensures that find dialog with non-null parent is destroyed by it when it is itself destroyed. Closes #18747. --- src/msw/fdrepdlg.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/msw/fdrepdlg.cpp b/src/msw/fdrepdlg.cpp index 374c3342ab..e8697749df 100644 --- a/src/msw/fdrepdlg.cpp +++ b/src/msw/fdrepdlg.cpp @@ -347,7 +347,9 @@ bool wxFindReplaceDialog::Create(wxWindow *parent, { m_windowStyle = flags; m_FindReplaceData = data; - m_parent = parent; + + if ( parent ) + parent->AddChild(this); SetTitle(title);