QTimeLine: do not restart() an invalid QElapsedTimer

It's UB (as per docs). Creating a QTimeLine and calling
setCurrentTime() will end up calling restart() without having called
start() first. Moreover, the return value of restart() isn't used,
so that's useless work.

Pick-to: 6.9 6.8 6.5
Change-Id: I53c80838f60fae406a44ffe2cf578c6c79cc9df4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2025-03-14 10:20:39 +01:00 committed by Marc Mutz
parent 5db60be476
commit a43453d9a2

View File

@ -538,7 +538,7 @@ void QTimeLine::setCurrentTime(int msec)
Q_D(QTimeLine);
d->startTime = 0;
d->currentLoopCount = 0;
d->timer.restart();
d->timer.start();
d->setCurrentTime(msec);
}