From d1e44484f7cc269ce7ed5dd0217a8b824aed5c6d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 7 Feb 2004 23:48:13 +0000 Subject: [PATCH] reset m_frameTool/StatusBar pointers before deleting them (bug 773474) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/mdi.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index db396ec1a3..edb246d750 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -233,12 +233,12 @@ bool wxMDIParentFrame::Create(wxWindow *parent, wxMDIParentFrame::~wxMDIParentFrame() { - DestroyChildren(); - - // already delete by DestroyChildren() + // see comment in ~wxMDIChildFrame m_frameToolBar = NULL; m_frameStatusBar = NULL; + DestroyChildren(); + if (m_windowMenu) { delete m_windowMenu; @@ -730,12 +730,13 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, wxMDIChildFrame::~wxMDIChildFrame() { - DestroyChildren(); - - // already deleted by DestroyChildren() + // will be destroyed by DestroyChildren() but reset them before calling it + // to avoid using dangling pointers if a callback comes in the meanwhile m_frameToolBar = NULL; m_frameStatusBar = NULL; + DestroyChildren(); + RemoveWindowMenu(NULL, m_hMenu); MSWDestroyWindow(); -- 2.45.2