Applied patch [ 642157 ] [MSW] HMENU resource leak from wxMenuBar
Latest CVS - When a wxMenuBar is detached from a frame and deleted the HMENU resource leaks. This patch fixes the leak. Scott Pleiter git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18128 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -557,6 +557,13 @@ wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
|
|||||||
|
|
||||||
wxMenuBar::~wxMenuBar()
|
wxMenuBar::~wxMenuBar()
|
||||||
{
|
{
|
||||||
|
// we should free Windows resources only if Windows doesn't do it for us
|
||||||
|
// which happens if we're attached to a frame
|
||||||
|
if (m_hMenu && !IsAttached())
|
||||||
|
{
|
||||||
|
::DestroyMenu((HMENU)m_hMenu);
|
||||||
|
m_hMenu = (WXHMENU)NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -838,8 +845,6 @@ void wxMenuBar::Attach(wxFrame *frame)
|
|||||||
|
|
||||||
void wxMenuBar::Detach()
|
void wxMenuBar::Detach()
|
||||||
{
|
{
|
||||||
m_hMenu = (WXHMENU)NULL;
|
|
||||||
|
|
||||||
wxMenuBarBase::Detach();
|
wxMenuBarBase::Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user