-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QTest: fix bug dereferencing nullptr in toString<std::nullptr_t>()
Amends commit 0756cc1. 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 ae02188. 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>
- Loading branch information
1 parent
91d86e4
commit e19b633
Showing
7 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters