X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3b60c67b973bf55987cd67483b9e421b6dbfefd5..5c250a10332dc17263c66deb629b5fa8c4320f8a:/src/msw/mdi.cpp 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();