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
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;
+ }
}
// ---------------------------------------------------------------------------
void wxMenuBar::Detach()
{
- m_hMenu = (WXHMENU)NULL;
-
wxMenuBarBase::Detach();
}