Repository navigation
Fix: app aborts on Linux after Assemble or deleting multi-part objects (object list GTK tree out of sync) - #671
Open
luicfrr wants to merge 1 commit into
Conversation
The object list is drawn with ImGui, but ObjectList is still a wxDataViewCtrl whose GtkTreeView is never expanded, so wxGTK never builds an object's children. ObjectDataViewModel::Delete() deleted an object's children first, each with ItemDeleted(object, child); for a child it does not know, wxGTK gets index -1 from GetIndexOf() and GTK deletes the row at the object's own path instead. The tree view drifts out of sync, and a later ItemAdded() (the merged object of "Assemble") could abort in _gtk_rbtree_insert_after(). On GTK, skip the per-child deletes: the existing ItemDeleted(plate, object) removes the row with its subtree, and the node's destructor frees the children. Other platforms are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Description
Summary
On Linux (GTK), deleting an object that has several parts leaves the object list's
GtkTreeViewout of sync withObjectDataViewModel. Later list changes can then make GTK abort the app. The most common trigger is Assemble on objects that are themselves assemblies; deleting such objects with the Delete key also triggers it. The cause is thatObjectDataViewModel::Delete()notifies the control about each part of an object, but wxGTK has never built those rows. This PR removes the object's row with a single notification on GTK.One file is changed:
src/slic3r/GUI/ObjectDataViewModel.cpp(+10 lines, all under#ifdef __WXGTK__). Windows and macOS are unchanged.Symptom
Open a project and import several
.3mffiles whose objects have several parts (each import adds "Assembly" objects).Select two of those objects and use Assemble from the context menu, or delete them with the Delete key.
Every time, stderr shows:
Sometimes, usually at the next Assemble, the app aborts with:
and
systemd-coredumprecords aSIGABRTfor/app/CrealityPrint.Root cause
The control never builds an object's children. The object list is drawn with ImGui, but
ObjectListis still awxDataViewCtrl, so aGtkTreeViewsits behind it, fed byObjectDataViewModel. wxGTK builds a node's children lazily, when GTK asks for them. Since that tree view is never expanded or shown to the user, the parts of an object are never built on the wxGTK side.Deleting an object notified each part. In
ObjectDataViewModel::Delete(), theitObjectbranch first deleted every child with a recursiveDelete(), and each one sentItemDeleted(object, child).wxGTK turns an unknown child into the wrong row.
wxGtkDataViewModelNotifier::ItemDeleted()builds the GTK path from the parent's path plusGetIndexOf(parent_node, item). For a child it never built,GetIndexOf()returns-1.gtk_tree_path_append_index()rejects-1(the assertion above), so the path stays the object's own path, andgtk_tree_model_row_deleted()deletes the object's row (or whichever row is at that path) instead of the child.The tree view drifts, then GTK aborts. Each part deleted this way removes another wrong row. The GTK tree no longer matches the model, and a later
ItemAdded()can hit the_gtk_rbtree_insert_after()assertion. With Assemble that is theItemAdded()for the merged object, right after the source objects are deleted.Evidence
The app was run under gdb with a breakpoint on
gtk_tree_path_append_indexwhen its index is negative. There were 16 hits in one session, all on this path:Backtrace of one of the aborts (stripped build, frames in
CrealityPrintidentified separately):Fix
src/slic3r/GUI/ObjectDataViewModel.cpp,ObjectDataViewModel::Delete(),itObjectbranch:ItemDeleted(parent, object)that already follows removes the object's row together with its subtree. GTK drops all child rows with it, whether or not wxGTK built them.~ObjectDataViewModelNode()deletes its children.Why only on GTK: the per-child path works on the generic and macOS implementations, and the extra work it does there (settings items, volume counters, instance roots) only updates nodes that are about to be destroyed. Restricting the change to GTK keeps the other platforms exactly as they are.
Not changed (possible follow-ups)
ObjectDataViewModel::DeleteChildren()andDeleteVolumeChildren()(used for example by "merge parts into one object") also sendItemDeleted()per child while keeping the parent, so they may hit the same-1on GTK. They did not show up in any of the captures above and are left as they are.Testing
Tested on Fedora 45, GNOME 50, Wayland, Flatpak (GNOME 50 runtime, LLVM 21), on the 7.3.2 sources;
ObjectDataViewModel.cppis identical on the currentmaster..3mffiles. Under gdb, 16 negative-index hits in one session, at every Assemble and every Delete of a multi-part object.index_ >= 0warning in the journal, no abort, no core dump.🤖 Generated with Claude Code