Skip to content

Gtk: Preserve CheckBox assignments and change notifications - #3125

Open
Descolada wants to merge 1 commit into
picoe:developfrom
keysharp-org:upstream/gtk-checkbox-checked
Open

Descolada wants to merge 1 commit into
picoe:developfrom
keysharp-org:upstream/gtk-checkbox-checked

Conversation

@Descolada

@Descolada Descolada commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Setting Checked = true on a GTK three-state CheckBox can leave it indeterminate instead: GTK emits Toggled for property assignments, and the click handler advances the state again. Repeated Checked = null assignments also raise duplicate notifications, and assignments made inside a click callback can lose their notification.

Detach the click-driven handler while updating the native state, restore it in finally, and raise CheckedChanged once when the logical value changes. Reconnect before callbacks so reentrant assignments remain observable. Also reset the click handler's recursion guard in finally; a throwing callback otherwise disables later cycling and notifications.

Adds four focused GTK3 tests covering assigned values and repeated-assignment notifications, one complete three-state click cycle, assignment from a click callback, and recovery after a throwing callback.

Keep programmatic Checked assignments separate from click-driven three-state
cycling. Notify once per logical value change and reconnect native toggles
before invoking callbacks so nested assignments remain observable.

Reset the native toggle guard in finally so a throwing callback does not
suppress later notifications and state transitions.

Add focused regression coverage for assignments, repeated values, native
clicks, nested callbacks and recovery after callback exceptions.
@Descolada
Descolada force-pushed the upstream/gtk-checkbox-checked branch from 9b078b2 to abe2f94 Compare October 27, 2026 08:44
@Descolada
Descolada marked this pull request as ready for review October 27, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants