Repository navigation
Closed
Labels
Description
Description with steps to reproduce
The group feature keeps raw pointers to node items. Some of them can be stale.
- Crash on model reset.
onModelResetcallsQGraphicsScene::clear()but keeps_groups.clear()deletes the group items, andNodeGroupstill owns them. Example: create a group, callsetOrientation(Qt::Vertical), destroy the scene. Segfault. - Node added twice.
addNodeToGroupdoes 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. NodeGrouphas two owners.createGroupmakes it withmake_sharedand also passes the scene as QObject parent. Keep theshared_ptrafter the scene is gone and release it: segfault.- Undo of a move can hit a deleted node.
MoveNodeCommanddoes not checknodeExists. A node removed outside the undo stack gets a position signal.DataFlowGraphModel::setNodeDatathen adds an orphan geometry entry.
Fixes:
- Clear
_groupsbeforeclear()inonModelReset. addNodeToGroupreturns if the node is already in the group, and removes it from the old group first.- Pass
nullptras the QObject parent ofNodeGroup. - Skip ids that fail
nodeExistsin 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
Fix crashes and stale pointers in the group lifetime
Fix crashes and stale pointers in the group lifetime
Fix crashes and stale pointers in the group lifetime
paceholder commentedon Nov 22, 2026
Fixed in 3.1.8 (PR #542). A model reset with a group, a node in two groups and the double owner of the group item do not crash any more.