diff options
author | Volker Hilsheimer <[email protected]> | 2025-03-23 09:58:29 +0100 |
---|---|---|
committer | Volker Hilsheimer <[email protected]> | 2025-03-24 05:59:45 +0100 |
commit | 9f63577dddfb01a9b78d6222b15489ee2320d82a (patch) | |
tree | c8f33c2bfc62e576e755966e7fab3d56554d54bf /src/concurrent/qtconcurrentmap.cpp | |
parent | 5be58ac9271555eed3a2884d827f30c164d2277d (diff) |
QGIM: test if a tuple row is valid before dereferencing
Row types that are convertible to bool, such as pointers, but also
unique_ptr and similar wrappers, should not be dereferenced when
accessing values for reading or writing. This is already done implicitly
when operating on single-value types, but for tuples we have to do so
explicitly, before accessing the element.
For example, inserting a row where the row type is a pointer will leave
that row be nullptr in the range, and both data and setData should fail
until a row has been constructed. For rows that are pointers to tuples,
we must never call get<>, as get cannot test if the item received is a
nullptr and still return a valid value (reference).
Since e.g. unique_ptr is explicitly convertible to bool we have to use
std::is_constructible rather than is_convertible, as the latter only
works for types that are implicitly convertible.
Change-Id: I9dbdf6e5cac0146ed5d1b88c523e182590b0c8ab
Reviewed-by: Artem Dyomin <[email protected]>
Diffstat (limited to 'src/concurrent/qtconcurrentmap.cpp')
0 files changed, 0 insertions, 0 deletions