Skip to content

Gtk: Avoid retaining window handlers in queued Shown callbacks - #3133

Merged
cwensley merged 1 commit into
picoe:developfrom
keysharp-org:upstream/gtk-posted-shown
Oct 28, 2026
Merged

cwensley merged 1 commit into
picoe:developfrom
keysharp-org:upstream/gtk-posted-shown

Conversation

@Descolada

@Descolada Descolada commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

When a GTK window closes while its Shown callback is queued, capturing the handler keeps it alive until the callback runs. Resolve the handler through the existing weak connector at dispatch time instead, retaining the closed-window guard and normal child-before-window event order.

The queued Shown callback previously captured the handler strongly, keeping the window and its managed state alive until dispatch, even after closure. Resolving the handler through the existing weak connector allows collection while the callback remains queued and safely skips notification if the handler is gone. This avoids unnecessary temporary retention and follows the existing weak-event design used elsewhere.

Resolve the handler through the weak connector when the queued callback runs,
instead of capturing it strongly. Preserve the existing closed-window guard
and child-before-window Shown ordering.
@Descolada
Descolada marked this pull request as ready for review October 27, 2026 15:02
@cwensley cwensley added the gtk label Oct 28, 2026
@cwensley cwensley added this to the 2.14.0 milestone Oct 28, 2026
@cwensley
cwensley merged commit 28832d3 into picoe:develop Oct 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants