diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2017-06-08 16:55:25 +0200 |
---|---|---|
committer | Albert Astals Cid <albert.astals.cid@kdab.com> | 2017-06-16 15:17:23 +0000 |
commit | b934cf056e3875a13af48eefe519cffe1332cde2 (patch) | |
tree | f6454aacaa40ea36f56cb227cd564deccd6d000c /src | |
parent | 19a5884e8d6bfa9d3bdfce359ce39deef4c48110 (diff) | |
download | qtmultimedia-b934cf056e3875a13af48eefe519cffe1332cde2.tar.gz |
Prevent m_runningCount from eventually overflowing
When m_loopCount is Infinite (i.e. -1) m_runningCount would go from -2
and down, eventuall wrapping and reaching 0 and thus stopping.
This is a theorical problem since even if we had a 1 second video it would
take lots of years to trigger but i guess it's better than
having the value of m_runningCount be unbounded
Change-Id: I340ec2157ece3334e58ab4afd77c34b478a256e9
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/multimedia/qdeclarativeaudio.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp index fc13323e8..652296509 100644 --- a/src/imports/multimedia/qdeclarativeaudio.cpp +++ b/src/imports/multimedia/qdeclarativeaudio.cpp @@ -900,7 +900,7 @@ void QDeclarativeAudio::componentComplete() void QDeclarativeAudio::_q_statusChanged() { if (m_player->mediaStatus() == QMediaPlayer::EndOfMedia && m_runningCount != 0) { - m_runningCount -= 1; + m_runningCount = std::max(m_runningCount - 1, -2); m_player->play(); } const QMediaPlayer::MediaStatus oldStatus = m_status; |