If wxMDIParentFrame object was created without its Create() ever being called,
it crashed in its dtor trying to delete an uninitialized pointer, so do
initialize it to NULL in all ctors (via a helper Init() method, as usual).
Closes #11216.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61986
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
{
public:
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
{
public:
+ wxMDIParentFrame() { Init(); }
wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxFrameNameStr)
{
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxFrameNameStr)
{
Create(parent, id, title, pos, size, style, name);
}
Create(parent, id, title, pos, size, style, name);
}
void UpdateClientSize();
private:
void UpdateClientSize();
private:
+ // common part of all ctors
+ void Init();
+
#if wxUSE_MENUS
// "Window" menu commands event handlers
void OnMDICommand(wxCommandEvent& event);
#if wxUSE_MENUS
// "Window" menu commands event handlers
void OnMDICommand(wxCommandEvent& event);
// the children
// ===========================================================================
// the children
// ===========================================================================
+void wxMDIParentFrame::Init()
+{
+#if wxUSE_MENUS && wxUSE_ACCEL
+ // the default menu doesn't have any accelerators (even if we have it)
+ m_accelWindowMenu = NULL;
+#endif // wxUSE_MENUS && wxUSE_ACCEL
+}
+
bool wxMDIParentFrame::Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
bool wxMDIParentFrame::Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
m_windowMenu->Append(wxID_MDI_WINDOW_PREV, _("&Previous"));
}
m_windowMenu->Append(wxID_MDI_WINDOW_PREV, _("&Previous"));
}
-#if wxUSE_MENUS && wxUSE_ACCEL
- // the default menu doesn't have any accelerators (even if we have it)
- m_accelWindowMenu = NULL;
-#endif // wxUSE_MENUS && wxUSE_ACCEL
-
if (!parent)
wxTopLevelWindows.Append(this);
if (!parent)
wxTopLevelWindows.Append(this);