You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Node groups: stale pointers and double ownership cause crashes #540
The group feature keeps raw pointers to node items. Some of them can be stale.
Crash on model reset.onModelReset calls QGraphicsScene::clear() but keeps _groups. clear() deletes the group items, and NodeGroup still owns them. Example: create a group, call setOrientation(Qt::Vertical), destroy the scene. Segfault.
Node added twice.addNodeToGroup does not check if the node is already a member. Use "Add to group..." on a node in a group: it is listed twice, or it stays in the old group too. After the node is deleted, the pointer is stale.
NodeGroup has two owners.createGroup makes it with make_shared and also passes the scene as QObject parent. Keep the shared_ptr after the scene is gone and release it: segfault.
Undo of a move can hit a deleted node.MoveNodeCommand does not check nodeExists. A node removed outside the undo stack gets a position signal. DataFlowGraphModel::setNodeData then adds an orphan geometry entry.
Fixes:
Clear _groups before clear() in onModelReset.
addNodeToGroup returns if the node is already in the group, and removes it from the old group first.
Pass nullptr as the QObject parent of NodeGroup.
Skip ids that fail nodeExists in the move command.
Each fix needs a test that fails before it. These are stop-gap fixes. The design issue for model-driven groups removes the cause.
Supporting files, videos and screenshots
No screenshots. I found it with tests that send simulated mouse events and with code reading.
Qt Version
Qt 6.12.0
Operating system
macOS 26.6
Additional context
Found while checking the node group commit 0d28130 (#514). Each crash was reproduced with a test. The stale pointers in point 2 were seen as wrong entry counts. I did not run a sanitizer.
Checklist
I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
I have attached all requested files and information to this report
I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible
Activity