]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
corrections for buffers
[wxWidgets.git] / src / msw / mdi.cpp
index db396ec1a333f9e79a932e316ffbf826c4c5f546..edb246d7500aaf3e647d0d2f0362cd17d9a84fdb 100644 (file)
@@ -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();