summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2018-01-19 10:30:24 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2018-01-24 10:13:00 +0000
commita966991b3af18d57182e5dc5a3ed4985d114b56d (patch)
tree9b4cf9ca6aeac98d730b9c7ba522ebd1e70cd345 /src/gui
parentf7524d73e33d00c76e55d996cdd4ea841ac6b7fa (diff)
Fix a crash when QMovie::speed is set to 0
Setting speed to 0 means the current frame will continue to be shown, the finished signal is not emitted, and state remains QMovie::Running. Task-number: QTBUG-65758 Change-Id: I681d902e3211c5899b21043e5177b7c73d5d3fb5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qmovie.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index d5e8b1b974..010760de4c 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -470,6 +470,10 @@ bool QMoviePrivate::next()
currentPixmap = QPixmap::fromImage( info.pixmap.toImage().scaled(scaledSize) );
else
currentPixmap = info.pixmap;
+
+ if (!speed)
+ return true;
+
nextDelay = speedAdjustedDelay(info.delay);
// Adjust delay according to the time it took to read the frame
int processingTime = time.elapsed();
@@ -504,7 +508,7 @@ void QMoviePrivate::_q_loadNextFrame(bool starting)
emit q->updated(frameRect);
emit q->frameChanged(currentFrameNumber);
- if (movieState == QMovie::Running)
+ if (speed && movieState == QMovie::Running)
nextImageTimer.start(nextDelay);
} else {
// Could not read another frame
@@ -926,6 +930,8 @@ void QMovie::setPaused(bool paused)
void QMovie::setSpeed(int percentSpeed)
{
Q_D(QMovie);
+ if (!d->speed && d->movieState == Running)
+ d->nextImageTimer.start(nextFrameDelay());
d->speed = percentSpeed;
}