Skip to content

QPersistentModelIndex: fix UB (op< on unrelated pointers)

Pointers can only be legitimately compared with less-than (<) if they point into the same array (or one past the end). This is decidedly not the case for heap-allocated objects like QPersistentModelIndexPrivates, so doing it is UB.

Fix by using std::less, which is guaranteed to be a total order, even for unrelated pointer values.

Pick-to: 6.6 6.5 6.2 5.15 Change-Id: If04341b4b55784e7732782f3ae829f53b0ceab9c Reviewed-by: David Faure (cherry picked from commit 49f92713)

Merge request reports