qt6-bb10/tests/auto/corelib/kernel
Ivan Solovev 612b67cf13 QTimer: do not set active state when setting a negative interval
QObject::startTimer() returns 0 in case of failure, for example when
someone tries to register a timer with a negative interval.

However, QTimer internally uses -1 as an invalid timer id.
This could lead to a situation when the timer was not really started,
but QTimer::isActive() returned true.

This patch fixes it in two ways:
- check the return value of QObject::startTimer() and treat 0 as an
  error.
- do not treat 0 as a valid timer id when calculating the active state.

As a drive-by: move the `using namespace std::chrono_literals;`
declaration to the top of tst_qtimer.cpp, so that we do not need to
repeat it in each test case.

Fixes: QTBUG-122087
Pick-to: 6.7 6.6 6.5
Change-Id: I0e21152b2173ebb5fb0dada1b99a903a321ca9c4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-02-12 23:49:54 +01:00
..
qapplicationstatic Change license for tests files 2024-02-04 09:56:42 +01:00
qcoreapplication Change license for tests files 2024-02-04 09:56:42 +01:00
qdeadlinetimer Change license for tests files 2024-02-04 09:56:42 +01:00
qelapsedtimer Change license for tests files 2024-02-04 09:56:42 +01:00
qeventdispatcher Change license for tests files 2024-02-04 09:56:42 +01:00
qeventloop Change license for tests files 2024-02-04 09:56:42 +01:00
qjniarray Change license for tests files 2024-02-04 09:56:42 +01:00
qjnienvironment Change license for tests files 2024-02-04 09:56:42 +01:00
qjniobject Change license for tests files 2024-02-04 09:56:42 +01:00
qjnitypes Change license for tests files 2024-02-04 09:56:42 +01:00
qmath Change license for tests files 2024-02-04 09:56:42 +01:00
qmetacontainer Change license for tests files 2024-02-04 09:56:42 +01:00
qmetaenum Change license for tests files 2024-02-04 09:56:42 +01:00
qmetamethod Change license for tests files 2024-02-04 09:56:42 +01:00
qmetaobject Change license for tests files 2024-02-04 09:56:42 +01:00
qmetaobjectbuilder Change license for tests files 2024-02-04 09:56:42 +01:00
qmetaproperty Change license for tests files 2024-02-04 09:56:42 +01:00
qmetatype Change license for tests files 2024-02-04 09:56:42 +01:00
qmimedata Change license for tests files 2024-02-04 09:56:42 +01:00
qobject QObject: fix installEventFilterOrder() test flakiness 2024-02-04 18:33:37 +01:00
qpermission Change license for tests files 2024-02-04 09:56:42 +01:00
qpointer Change license for tests files 2024-02-04 09:56:42 +01:00
qproperty Change license for tests files 2024-02-04 09:56:42 +01:00
qsignalblocker Change license for tests files 2024-02-04 09:56:42 +01:00
qsignalmapper Change license for tests files 2024-02-04 09:56:42 +01:00
qsocketnotifier Change license for tests files 2024-02-04 09:56:42 +01:00
qtimer QTimer: do not set active state when setting a negative interval 2024-02-12 23:49:54 +01:00
qtranslator Change license for tests files 2024-02-04 09:56:42 +01:00
qvariant Change license for tests files 2024-02-04 09:56:42 +01:00
qwineventnotifier Change license for tests files 2024-02-04 09:56:42 +01:00
qwinregistrykey Change license for tests files 2024-02-04 09:56:42 +01:00
CMakeLists.txt JNI: add QJniArray class for easier working with arrays 2023-10-16 18:43:16 +02:00