diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index 7dfaf63fc6..f5df0290d1 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -68,6 +68,7 @@ public: bool Show(bool show); + void DetachMenuBar(); // Set menu bar void SetMenuBar(wxMenuBar *menu_bar); virtual wxMenuBar *GetMenuBar() const; diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 1f463ef76a..a5765f0fa0 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -418,12 +418,20 @@ void wxFrame::PositionStatusBar() } #endif // wxUSE_STATUSBAR +void wxFrame::DetachMenuBar() +{ + if (m_frameMenuBar) + { + m_frameMenuBar->Detach(); + m_frameMenuBar = NULL; + } +} + void wxFrame::SetMenuBar(wxMenuBar *menu_bar) { if (!menu_bar) { - delete m_frameMenuBar; - m_frameMenuBar = NULL; + DetachMenuBar(); return; }