Initialize wxMDIParentFrame::m_accelWindowMenu in default ctor.
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
This commit is contained in:
@@ -24,7 +24,7 @@ class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable;
|
|||||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMDIParentFrame() { }
|
wxMDIParentFrame() { Init(); }
|
||||||
wxMDIParentFrame(wxWindow *parent,
|
wxMDIParentFrame(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
@@ -33,6 +33,8 @@ public:
|
|||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||||
const wxString& name = wxFrameNameStr)
|
const wxString& name = wxFrameNameStr)
|
||||||
{
|
{
|
||||||
|
Init();
|
||||||
|
|
||||||
Create(parent, id, title, pos, size, style, name);
|
Create(parent, id, title, pos, size, style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +123,9 @@ protected:
|
|||||||
void UpdateClientSize();
|
void UpdateClientSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// common part of all ctors
|
||||||
|
void Init();
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
#if wxUSE_MENUS
|
||||||
// "Window" menu commands event handlers
|
// "Window" menu commands event handlers
|
||||||
void OnMDICommand(wxCommandEvent& event);
|
void OnMDICommand(wxCommandEvent& event);
|
||||||
|
@@ -138,6 +138,14 @@ END_EVENT_TABLE()
|
|||||||
// 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,
|
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
@@ -162,11 +170,6 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
|||||||
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)
|
if (!parent)
|
||||||
wxTopLevelWindows.Append(this);
|
wxTopLevelWindows.Append(this);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user