Fix voice record button infinite animation

Enabling animations triggers an animation of the voice record button
that keeps firing uselessly at ~120 calls per second until the button
is manually toggled. The animation callback cannot stop itself since
it expects the button to be visible.

This commit fixes the issue by preventing spawning the animation if
the widget is hidden.
This commit is contained in:
Loïc Molinari 2021-04-14 22:06:56 +02:00 committed by John Preston
parent 2eda5bb2d8
commit 336405b3c7
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@ void VoiceRecordButton::init() {
_blobs->setLevel(0.);
}
_blobsHideLastTime = hide ? crl::now() : 0;
if (!hide && !_animation.animating()) {
if (!hide && !_animation.animating() && isVisible()) {
_animation.start();
}
}, lifetime());