Skip to content

[GTK4] Remove menu item actions from the action group on dispose - #3476

Merged
akurtakov merged 1 commit into
eclipse-platform:masterfrom
akurtakov:gtk4-menuitem-action-removal
Jul 30, 2026
Merged

[GTK4] Remove menu item actions from the action group on dispose#3476
akurtakov merged 1 commit into
eclipse-platform:masterfrom
akurtakov:gtk4-menuitem-action-removal

Conversation

@akurtakov

@akurtakov akurtakov commented Jul 30, 2026

Copy link
Copy Markdown
Member

Menu inserts its action group on the shell under a prefix, so an item's action has two names: the plain one it was registered with, and the detailed menuHash.itemHash that resolves through the prefix.

releaseWidget() passed the detailed name to g_action_map_remove_action(), which keys actions by their plain name, so it silently removed nothing and entries accumulated for the lifetime of the group. Store the plain name as actionId and remove by that, keeping actionName for the places that refer to an action by name (GMenuItem, GtkNamedAction). All four item styles were affected.

Menu inserts its action group on the shell under a prefix, so an item's
action has two names: the plain one it was registered with, and the
detailed menuHash.itemHash that resolves through the prefix.

releaseWidget() passed the detailed name to g_action_map_remove_action(),
which keys actions by their plain name, so it silently removed nothing and
entries accumulated for the lifetime of the group. Store the plain name as
actionId and remove by that, keeping actionName for the places that refer
to an action by name (GMenuItem, GtkNamedAction). All four item styles
were affected.

This does not free the action itself: the reference from
g_simple_action_new() is never released, and unref'ing it here leaves the
top-level menu bar items without labels.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Test Results (linux)

  109 files  ±0    109 suites  ±0   14m 34s ⏱️ -15s
4 613 tests ±0  4 387 ✅ ±0  226 💤 ±0  0 ❌ ±0 
3 428 runs  ±0  3 350 ✅ ±0   78 💤 ±0  0 ❌ ±0 

Results for commit 940466c. ± Comparison against base commit 9ad9b73.

@akurtakov
akurtakov merged commit 5ac8459 into eclipse-platform:master Jul 30, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant