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:
Julian Smart
2002-12-09 09:29:00 +00:00
parent fc7c8ae9c3
commit 7a0363dd04

View File

@@ -557,6 +557,13 @@ wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
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()
{
m_hMenu = (WXHMENU)NULL;
wxMenuBarBase::Detach();
}