path: root/tests
diff options
authorVal Doroshchuk <>2017-10-11 17:05:53 +0200
committerVaL Doroshchuk <>2017-11-10 10:11:34 +0000
commit4a214b199337a02e8cab77aa0cdca0c2805fb6a2 (patch)
tree9aab076dd062790a6f6d4704997d5edbb64c77b8 /tests
parentb0c352054e64b0fc64e547bf54dad1bdeaee283a (diff)
Fix deadlock when a new url is set in loading state
Setting a new url while QMediaPlayer is in loading state can result in a deadlock between the GUI and worker thread. Because main thread is waiting when worker realeses m_graph but worker cleared all pending tasks and is waiting for new tasks from main thread. Task-number: QTBUG-53534 Change-Id: I296ecdf866c5d85efc7121d3e7936334d6b700fd Reviewed-by: Timur Pocheptsov <> Reviewed-by: Maurice Kalinowski <> Reviewed-by: Christian Stromme <>
Diffstat (limited to 'tests')
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index 5a703f2e1..9fe0a39ec 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -59,6 +59,7 @@ private slots:
void construction();
void loadMedia();
void unloadMedia();
+ void loadMediaInLoadingState();
void playPauseStop();
void processEOS();
void deleteLaterAtEOS();
@@ -325,6 +326,16 @@ void tst_QMediaPlayerBackend::unloadMedia()
+void tst_QMediaPlayerBackend::loadMediaInLoadingState()
+ const QUrl url("");
+ QMediaPlayer player;
+ player.setMedia(QMediaContent(url));
+ // Sets new media while old has not been finished.
+ player.setMedia(QMediaContent(url));
+ QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::InvalidMedia);
void tst_QMediaPlayerBackend::playPauseStop()