- // Windows seems really bad on Menu de-allocation...
- // After many try, here is what I do: RemoveMenu() will ensure
- // that popup are "disconnected" from their parent; then call
- // delete method on each child (which in turn do a recursive job),
- // and finally, DestroyMenu()
- //
- // With that, BoundCheckers is happy, and no complaints...
- /*
- int N = 0 ;
- if (m_hMenu)
- N = GetMenuItemCount(m_hMenu);
- int i;
- for (i = N-1; i >= 0; i--)
- RemoveMenu(m_hMenu, i, MF_BYPOSITION);
- */
-
- // How is deleting submenus in this loop any different from deleting
- // the submenus in the children list, via ~wxWindow ?
- // I'll reinstate this deletion for now and remove addition
- // from children list (which doesn't exist now)
- // Julian 1/3/97
- wxNode *node = m_menuItems.First();
- while (node)
- {
- wxMenuItem *item = (wxMenuItem *)node->Data();
-
- // Delete child menus.
- // Beware: they must not be appended to children list!!!
- // (because order of delete is significant)
- if (item->GetSubMenu())
- item->DeleteSubMenu();
-
- wxNode *next = node->Next();
- delete item;
- delete node;
- node = next;
- }
- /*
- if (m_hMenu)
- DestroyMenu(m_hMenu);
- m_hMenu = 0;
- */