Skip to content

fix: menu items not cleaned up after rebuild - #50830

Merged
codebytere merged 1 commit into
41-x-yfrom
trop/41-x-y-bp-fix-menu-items-not-cleaned-up-after-rebuild-1775703407760
Apr 9, 2026
Merged

codebytere merged 1 commit into
41-x-yfrom
trop/41-x-y-bp-fix-menu-items-not-cleaned-up-after-rebuild-1775703407760

Conversation

@trop

@trop trop Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Backport of #50806

See that PR for details.

Notes: Fixed a memory leak where Menu items were not cleaned up after Menu.setApplicationMenu was called repeatedly.

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.

Co-authored-by: Shelley Vohr <[email protected]>
@trop
trop Bot requested review from a team and codebytere April 9, 2026 02:56
@trop trop Bot mentioned this pull request Apr 9, 2026
4 tasks done
@trop trop Bot added 41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Apr 9, 2026
@codebytere
codebytere merged commit 1ad20e5 into 41-x-y Apr 9, 2026
113 of 117 checks passed
@codebytere
codebytere deleted the trop/41-x-y-bp-fix-menu-items-not-cleaned-up-after-rebuild-1775703407760 branch April 9, 2026 09:56
@release-clerk

release-clerk Bot commented Apr 9, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a memory leak where Menu items were not cleaned up after Menu.setApplicationMenu was called repeatedly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant