diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index dfd87bdec6f..9224e5fb43f 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -245,7 +245,8 @@ void QWaylandInputDevice::Pointer::updateCursor() return; // Set from shape using theme - uint time = seat()->mCursor.animationTimer.elapsed(); + const QElapsedTimer &timer = seat()->mCursor.animationTimer; + const uint time = timer.isValid() ? timer.elapsed() : 0; if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) { uint duration = 0; diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 3cfcdfe7d00..8973d67b72f 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -113,7 +113,8 @@ void QWaylandTabletToolV2::updateCursor() return; // Set from shape using theme - uint time = m_tabletSeat->seat()->mCursor.animationTimer.elapsed(); + QElapsedTimer &timer = m_tabletSeat->seat()->mCursor.animationTimer; + const uint time = timer.isValid() ? timer.elapsed() : 0; if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) { uint duration = 0; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 92a338663d8..a1534c0b0ff 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1682,12 +1682,13 @@ void QWaylandWindow::timerEvent(QTimerEvent *event) { QMutexLocker lock(&mFrameSyncMutex); - bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout); - if (!mFrameCallbackElapsedTimer.isValid() || callbackTimerExpired ) { + const bool callbackTimerValid = mFrameCallbackElapsedTimer.isValid(); + const bool callbackTimerExpired = callbackTimerValid && mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout); + if (!callbackTimerValid || callbackTimerExpired) { killTimer(mFrameCallbackCheckIntervalTimerId); mFrameCallbackCheckIntervalTimerId = -1; } - if (!mFrameCallbackElapsedTimer.isValid() || !callbackTimerExpired) { + if (!callbackTimerValid || !callbackTimerExpired) { return; } mFrameCallbackElapsedTimer.invalidate();