- if (m_frameMenuBar)
- delete m_frameMenuBar;
-
- m_hMenu = pMenuBar->Create();
- m_ulMenubarId = pMenuBar->GetMenubarId();
- if (m_ulMenubarId != FID_MENU)
+ // Can set a menubar several times.
+ // TODO: how to prevent a memory leak if you have a currently-unattached
+ // menubar? wxWindows assumes that the frame will delete the menu (otherwise
+ // there are problems for MDI).
+ if (pMenuBar->GetHMenu())