summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2025-01-29 09:40:49 -0800
committerThiago Macieira <thiago.macieira@intel.com>2025-01-30 15:57:07 -0800
commite19b633c468123526660b40ae110f46090682c76 (patch)
tree874098759a0f9bd9e496fc5c3260e2c7b693898c /src/corelib/kernel/qobject.cpp
parent91d86e4f7a58cc2f3071234e42848928a4aea45c (diff)
QTest: fix bug dereferencing nullptr in toString<std::nullptr_t>()
Amends commit 0756cc1eae5fd8981983319fef1d084762a67b8d. The generic instantiation of this function had a std::nullptr_t * parameter, but callers had special code to pass a nullptr there because we never needed a value of a nullptr (it's always a null pointer). For example, in compare_ptr_helper(): auto lhsFormatter = Internal::pointerToString<QObject>; auto rhsFormatter = Internal::genericToString<std::nullptr_t>; return compare_helper(t1 == nullptr, "Compared QObject pointers are not the same", const_cast<const QObject *>(t1), nullptr, lhsFormatter, rhsFormatter, actual, expected, file, line); But in debug mode, some compilers did emit a load from this memory location, causing a crash. So we just specialize this function to avoid such. We had a test for this... except it was never reached because the earlier QCOMPARE() had already failed. For the test, this amends commit ae021882330abc5f6fbaadca290e6e5670c89028. Fixes: QTBUG-133330 Pick-to: 6.9 6.8 Change-Id: I2cd3bb475788431c6a0dfffd28e730e8b613e033 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
0 files changed, 0 insertions, 0 deletions