qt6-bb10/tests/auto/concurrent
Ivan Solovev 936e72d180 Fix QThreadPool::maxThreadCount() usage
The docs claim that QThreadPool always creates at least one thread.
However, the user can (usually by mistake) request zero or a negative
number of threads.
The maxThreadCount() function is simply returning the value, that was
requested by the user.
Since it's a public API, it is used in several places in QtConcurrent,
where it is assumed that the value is always positive. This can lead
to a crash if the user sets zero as a maxThreadCount.

Update all such places with std::max(maxThreadCount(), 1).
Prefer this approach over changing the return value of
maxThreadCount(), because its behavior is documented and tested.

Amends 885eff0537.

Fixes: QTBUG-120335
Pick-to: 6.7 6.6 6.5 6.2
Change-Id: Id3b2087cec7fbc7a2d42febca6586f2dacffe444
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-08 18:29:26 +01:00
..
qtconcurrentfilter CMake: Make qtbase tests standalone projects 2023-07-05 15:09:32 +02:00
qtconcurrentfiltermapgenerated CMake: Make qtbase tests standalone projects 2023-07-05 15:09:32 +02:00
qtconcurrentiteratekernel CMake: Make qtbase tests standalone projects 2023-07-05 15:09:32 +02:00
qtconcurrentmap Fix QThreadPool::maxThreadCount() usage 2024-01-08 18:29:26 +01:00
qtconcurrentmedian tst_QtConcurrentMedian: compile with QT_NO_FOREACH 2023-08-19 16:28:20 +03:00
qtconcurrentrun QtConcurrent::run() test: Add tests taking static function 2023-11-09 16:52:44 +00:00
qtconcurrenttask CMake: Make qtbase tests standalone projects 2023-07-05 15:09:32 +02:00
qtconcurrentthreadengine Mark all of Qt as free of Q_FOREACH, except where it isn't 2023-08-19 05:19:42 +00:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
testhelper_functions.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00