Skip to content

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

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

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

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 40-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Apr 9, 2026
@codebytere
codebytere merged commit 31cc872 into 40-x-y Apr 9, 2026
70 of 71 checks passed
@codebytere
codebytere deleted the trop/40-x-y-bp-fix-menu-items-not-cleaned-up-after-rebuild-1775703408548 branch April 9, 2026 08:48
@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

40-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