summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets/code/doc_gui_widgets_qopenglwidget.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-06-05 16:43:46 -0700
committerMarc Mutz <marc.mutz@qt.io>2024-06-07 06:30:42 +0000
commit9d5611dc97979dab1932b07f8cfab367c3872d24 (patch)
tree71363d01f38bdb5ed05dfc7f47a7a619da6a856b /src/widgets/doc/snippets/code/doc_gui_widgets_qopenglwidget.cpp
parentd5e38752db3f00b4811210c8b6881e9b6415af7e (diff)
tst_QStringConverter: compare pointer distances, not pointersHEADdev
Strictly speaking, we did want to compare pointers, but char* are special with QCOMPARE in that the pointed-to strings are compared, not the pointers. So this wasn't doing what we wanted it to do. We could static_cast to void* to do it, but subtracting one from the other also gets us what we want, with simpler code. The drawback is that if appendToBuffer() ever returns nullptr, we'll print a huge number as the offset. Found by Valgrind: ==3769588== Conditional jump or move depends on uninitialised value(s) ==3769588== at 0x483FEDC: strcmp (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==3769588== by 0x4C41EB6: qstrcmp(char const*, char const*) (in lib/libQt6Core.so.6.9.0) ==3769588== by 0x48975D8: QTest::compare_string_helper(char const*, char const*, char const*, char const*, char const*, int) (in lib/libQt6Test.so.6.9.0) ==3769588== by 0x12B12A: QTest::qCompare(char*, char*, char const*, char const*, char const*, int) (in tests/auto/corelib/text/qstringconverter/tst_qstringconverter) ==3769588== by 0x10EE94: tst_QStringConverter::invalidConverter() (in tests/auto/corelib/text/qstringconverter/tst_qstringconverter) Amends c46ee7df57c30c94107df8506d30d8872ffa3baa. Pick-to: 6.2 6.5 6.7 6.8 Fixes: QTBUG-126107 Change-Id: I44265a5eb67e47a59fc8fffd17d64051657af529 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/widgets/doc/snippets/code/doc_gui_widgets_qopenglwidget.cpp')
0 files changed, 0 insertions, 0 deletions