QChronoTimer: compare timer IDs to Qt::TimerId::Invalid consistently
Always `if (id != Qt::TimerId::Invalid)`. Change-Id: If16e1cb54d3e7b4325019eb292263c25cd7d3805 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 637fcc69c87352c21658fea1083e93786f64fc37) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
cb35f1e858
commit
e97da8bc9d
@ -193,7 +193,7 @@ void QChronoTimer::start()
|
||||
if (d->isActive()) // stop running timer
|
||||
stop();
|
||||
const auto id = Qt::TimerId{QObject::startTimer(d->intervalDuration, d->type)};
|
||||
if (id > Qt::TimerId::Invalid) {
|
||||
if (id != Qt::TimerId::Invalid) {
|
||||
d->id = id;
|
||||
d->isActiveData.notify();
|
||||
}
|
||||
@ -293,7 +293,7 @@ void QChronoTimer::setInterval(std::chrono::nanoseconds nsec)
|
||||
if (d->isActive()) { // Create new timer
|
||||
QObject::killTimer(d->id); // Restart timer
|
||||
const auto newId = Qt::TimerId{QObject::startTimer(nsec, d->type)};
|
||||
if (newId > Qt::TimerId::Invalid) {
|
||||
if (newId != Qt::TimerId::Invalid) {
|
||||
// Restarted successfully. No need to update the active state.
|
||||
d->id = newId;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user