Skip to content

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

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

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

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:57
@trop trop Bot mentioned this pull request Apr 9, 2026
4 tasks done
@trop trop Bot added 42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Apr 9, 2026
@codebytere
codebytere merged commit f9de33b into 42-x-y Apr 9, 2026
264 of 278 checks passed
@codebytere
codebytere deleted the trop/42-x-y-bp-fix-menu-items-not-cleaned-up-after-rebuild-1775703409554 branch April 9, 2026 13:19
@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

42-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.

2 participants