Release the menu's native resources: drop its items from the command
registry and destroy its HMENU (which frees any submenu handles too).
Call this on a standalone context menu (one shown with showPopupMenu) when
you are finished with it — an app that rebuilds context menus per invocation
would otherwise leak an HMENU and command-registry entries each time. A
menu attached to a MenuBar or as a submenu is owned by its parent and
freed when the parent is disposed; calling dispose on it is still safe.
Idempotent.
Release the menu's native resources: drop its items from the command registry and destroy its HMENU (which frees any submenu handles too).
Call this on a standalone context menu (one shown with showPopupMenu) when you are finished with it — an app that rebuilds context menus per invocation would otherwise leak an HMENU and command-registry entries each time. A menu attached to a MenuBar or as a submenu is owned by its parent and freed when the parent is disposed; calling dispose on it is still safe. Idempotent.