summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2018-11-09 15:36:11 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-02-08 09:55:36 +0000
commitd6c69017130405d945df7f9bd8b529932b158806 (patch)
treed2ad82af67e8dd403d05e258f168e7a12ab0ffa0
parent86172a759d40b0dc6dc664ba79581bf315526788 (diff)
Fix crash in player example when close the window while playing
When it is playing and close the window: 1. The player object will be destroyed first (all QString's). 2. Next parent QWidget will be destroyed with all children. 3. While destroying QMediaPlayer from Player object, the playback will be stopped. 4. The status will be changed and Player::statusChanged will be called. The connection still exists. And since all string members are already freed, it produces a crash. Change-Id: I2c2fdca97f0ff4b300527b550ecc0c12b04e5b4e Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 19d4ec42c..e90035cce 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -648,6 +648,9 @@ QMediaPlayer::~QMediaPlayer()
Q_D(QMediaPlayer);
d->disconnectPlaylist();
+ // Disconnect everything to prevent notifying
+ // when a receiver is already destroyed.
+ disconnect();
if (d->service) {
if (d->control)