From a43453d9a2b12943cb4528a4249fce407a3318f4 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 14 Mar 2025 10:20:39 +0100 Subject: [PATCH] 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 --- src/corelib/tools/qtimeline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index fd3c7e48fed..5c759efd7e8 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -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); }