From 7158c9b5be34581a8b5990d6fd29239bfb9615e6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 May 2020 20:21:23 +0200 Subject: [PATCH] Use Destroy() rather than delete for dialogs in the sample Even though it doesn't make any real difference for these dialogs, we still shouldn't delete top level windows directly and should rather call Destroy() on them to let them be cleaned up during the next idle time processing. See #18747. --- samples/dialogs/dialogs.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index d54faab308..c5c1cc1da7 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -3038,7 +3038,9 @@ void MyFrame::ShowReplaceDialog( wxCommandEvent& WXUNUSED(event) ) { if ( m_dlgReplace ) { - wxDELETE(m_dlgReplace); + m_dlgReplace->Destroy(); + + m_dlgReplace = NULL; } else { @@ -3058,7 +3060,9 @@ void MyFrame::ShowFindDialog( wxCommandEvent& WXUNUSED(event) ) { if ( m_dlgFind ) { - wxDELETE(m_dlgFind); + m_dlgFind->Destroy(); + + m_dlgFind = NULL; } else {