summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/transform/main.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2025-07-30 17:11:10 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2025-08-04 14:42:40 +0200
commit2d501fc583adc0e38085a02e654ea4ae3c1c2971 (patch)
treedca8c591e80034d414df837e2db386b030a28ee7 /src/gui/doc/snippets/transform/main.cpp
parent74ef389673741cbdeca61ca9589c54206366c2df (diff)
QRM: fix setItemData for unique_ptr items
The transaction implementation in setItemData tries to make a copy of the original item, then writes to that copy, and swaps the original item with the modified copy only if all changes were written successfully. The write-operation happens on a pointer to that item via QMetaProperty APIs. So for non-copyable items, we return a pointer to the origin. If the item is owned by a unique_ptr, then we cannot make copies, so we write to the pointer to the original item. Use our pointerTo helper to get that pointer in all cases to unwrap unique_ptr. Otherwise, we'd pass the address of the unique_ptr to the QMetaProperty API and crash. Add test coverage, and enable SetItemData tests for listOfObjects as well. Pick-to: 6.10 Change-Id: Ia23c22f60171aacea64259a97b64ec7278db35a0 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Diffstat (limited to 'src/gui/doc/snippets/transform/main.cpp')
0 files changed, 0 insertions, 0 deletions