Commit f844007b authored by David Edmundson's avatar David Edmundson
Browse files

Guard against cursor theme changing in animation timer

PreviewWidget has a timer that advances to the next frame of the current
cursor.

"current" can change in setTheme, we need to stop the animation timer

BUG: 456526


(cherry picked from commit ddf88d21)
parent 514954ea
Pipeline #203088 passed with stage
in 11 minutes and 9 seconds
......@@ -115,6 +115,7 @@ PreviewWidget::PreviewWidget(QQuickItem *parent)
setAcceptHoverEvents(true);
current = nullptr;
connect(&m_animationTimer, &QTimer::timeout, this, [this] {
Q_ASSERT(current);
setCursor(QCursor(QPixmap::fromImage(current->images().at(nextAnimationFrame).image)));
m_animationTimer.setInterval(current->images().at(nextAnimationFrame).delay);
nextAnimationFrame = (nextAnimationFrame + 1) % current->images().size();
......@@ -245,6 +246,7 @@ void PreviewWidget::setTheme(const CursorTheme *theme, const int size)
}
current = nullptr;
m_animationTimer.stop();
update();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment