mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
Menu was holding a SelfKeepAlive to itself from construction, so any Menu that was never opened (e.g. an application menu replaced before being shown) stayed pinned in cppgc forever. Repeated calls to Menu.setApplicationMenu leaked every prior Menu along with its model and items. Restore the original Pin/Unpin lifecycle: start keep_alive_ empty and only assign `this` in OnMenuWillShow. OnMenuWillClose already clears it.