]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
applied patch 890642: wxRE_ADVANCED flag and docs
[wxWidgets.git] / src / msw / mdi.cpp
index 5d2e46955cb02cd31d59987a4dca7a0999caf280..5f980abb3d50fcaf62ca5263f72a3a04e169c3de 100644 (file)
@@ -233,12 +233,14 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
 
 wxMDIParentFrame::~wxMDIParentFrame()
 {
-    DestroyChildren();
-
-    // already delete by DestroyChildren()
+    // see comment in ~wxMDIChildFrame
+#if wxUSE_TOOLBAR
     m_frameToolBar = NULL;
+#endif
     m_frameStatusBar = NULL;
 
+    DestroyChildren();
+
     if (m_windowMenu)
     {
         delete m_windowMenu;
@@ -696,7 +698,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
   else
       mcs.cy = CW_USEDEFAULT;
 
-  DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_THICKFRAME | WS_VISIBLE ;
+  DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_VISIBLE ;
   if (style & wxMINIMIZE_BOX)
     msflags |= WS_MINIMIZEBOX;
   if (style & wxMAXIMIZE_BOX)
@@ -730,12 +732,15 @@ 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
+#if wxUSE_TOOLBAR
     m_frameToolBar = NULL;
+#endif
     m_frameStatusBar = NULL;
 
+    DestroyChildren();
+
     RemoveWindowMenu(NULL, m_hMenu);
 
     MSWDestroyWindow();
@@ -1026,11 +1031,13 @@ bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
             lpPos->cx = rectClient.right - rectClient.left;
             lpPos->cy = rectClient.bottom - rectClient.top;
         }
+#if wxUSE_TOOLBAR
         wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent();
         if (pFrameWnd && pFrameWnd->GetToolBar() && pFrameWnd->GetToolBar()->IsShown())
         {
             pFrameWnd->GetToolBar()->Refresh();
         }
+#endif
     }
 #endif // Win95