Skip to content

Empty ListBoxes with remove_all to avoid stale rows crashing GTK (#153) - #194

Merged
gnacho merged 1 commit into
mainfrom
fix/153-gtk-segv
Aug 26, 2026
Merged

Empty ListBoxes with remove_all to avoid stale rows crashing GTK (#153)#194
gnacho merged 1 commit into
mainfrom
fix/153-gtk-segv

Conversation

@gnacho

@gnacho gnacho commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Closes #153.

Problem

The app dies intermittently with SIGSEGV inside GTK widget-tree code during sync. Two coredumps: gtk_widget_get_request_mode (~42s after launch) and gtk_widget_is_sensitive (mid-sync, 3h uptime). Same failure class as the crashes fixed in #102/#121 (live callbacks touching widgets that left the tree).

Root cause (verified against GTK 4.22 source)

src/ui/conflict_resolver.rs rebuilt three GtkListBoxes by looping while let Some(child) = list.first_child() { child.unparent(); } (reload_deletions, reload_conflicts, rebuild_recent). In GTK4, gtk_widget_unparent does NOT clear the box's internal children sequence (only gtk_list_box_remove does), leaving ghost rows that, when freed, produce the exact asserts in the issue (insert_after with an invalid previous_sibling, G_IS_OBJECT failure) and the SEGV in gtk_widget_is_sensitive/gtk_widget_get_request_mode. The Recent tab rebuilds on a 2s poll whenever the activity log changes, i.e. during a sync - matching the intermittency.

Fix

src/ui/conflict_resolver.rs: replace the unparent loop with list.remove_all() in the three functions (the pattern already used at settings.rs:1865; gtk_list_box_remove_all exists since GTK 4.12, we build against v4_22).

Testing

New regression test rebuild_recent_replaces_the_rows_cleanly: rebuild with N rows, rebuild again with 1, assert only the new row remains (would fail with the unparent loop due to ghost children). Gate: clippy clean, fmt applied, tests green. No coredumps were recoverable today (the two in the issue remain the evidence); the fix targets the one identified stale-children vector that matches all observed asserts.

@gnacho
gnacho merged commit 42a57a6 into main Aug 26, 2026
2 checks passed
@gnacho
gnacho deleted the fix/153-gtk-segv branch August 26, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intermittent SIGSEGV in the GTK widget tree during sync (gtk_widget_insert_after / gtk_widget_is_sensitive assertions)

1 participant