Empty ListBoxes with remove_all to avoid stale rows crashing GTK (#153) - #194
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) andgtk_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.rsrebuilt threeGtkListBoxes by loopingwhile let Some(child) = list.first_child() { child.unparent(); }(reload_deletions,reload_conflicts,rebuild_recent). In GTK4,gtk_widget_unparentdoes NOT clear the box's internalchildrensequence (onlygtk_list_box_removedoes), leaving ghost rows that, when freed, produce the exact asserts in the issue (insert_afterwith an invalidprevious_sibling,G_IS_OBJECTfailure) and the SEGV ingtk_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 withlist.remove_all()in the three functions (the pattern already used atsettings.rs:1865;gtk_list_box_remove_allexists 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.