Skip to content

fix: don't switch view from inside Gtk event delivery - #21867

Open
da-phil wants to merge 1 commit into
darktable-org:masterfrom
da-phil:pl/do_not_switch_view_from_inside_gtk_event_delivery
Open

fix: don't switch view from inside Gtk event delivery#21867
da-phil wants to merge 1 commit into
darktable-org:masterfrom
da-phil:pl/do_not_switch_view_from_inside_gtk_event_delivery

Conversation

@da-phil

@da-phil da-phil commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

A view switch removes every lib module widget from its container and leaves the thumbtable parentless until the filmstrip re-parents it from its draw handler. Done from a gesture handler, this unrealizes widgets Gtk is still propagating the current event through:

  Gtk-CRITICAL gtk_widget_event: assertion
                'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed

The inline switch on double-click dates back to 8af6194, but was harmless
as long as the gesture ran in the bubble phase: the handler was then reached
through the widget itself, and propagation stopped right after it on the now
parentless thumbtable. It only became visible when 650a5ff moved the
thumbtable click gesture to the capture phase, where the handler runs before
Gtk propagates the press.

Postpone the switch to a G_PRIORITY_HIGH idle while an event is being
delivered -- g_main_context_invoke() does not, on the gui thread it runs the
callback synchronously -- and let the thumbtable/culling double-click go
through dt_ctl_switch_mode_to() rather than switching directly.

Fixes: #21862

Disclaimer: this work has been co-created with Claude.

A view switch removes every lib module widget from its container and leaves
the thumbtable parentless until the filmstrip re-parents it from its draw
handler.  Done from a gesture handler, this unrealizes widgets Gtk is still
propagating the current event through:

  Gtk-CRITICAL gtk_widget_event: assertion
                'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed

It shows on every darkroom entry since 650a5ff put the thumbtable click
gesture in the capture phase, where the handler runs before Gtk propagates
the press.

Postpone the switch to a G_PRIORITY_HIGH idle while an event is being
delivered -- g_main_context_invoke() does not, on the gui thread it runs the
callback synchronously -- and let the thumbtable/culling double-click go
through dt_ctl_switch_mode_to() rather than switching directly.
@TurboGit TurboGit added this to the 5.8 milestone Aug 16, 2026
@TurboGit TurboGit added bugfix pull request fixing a bug gtk4 labels Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug gtk4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Entering darkroom raise a Gtk-CRITICAL

2 participants