From d7533fd9357ad9452ff094231307edd30da33a88 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Wed, 12 Mar 2014 13:29:55 +0100 Subject: [PATCH] AVFoundation: Fix another crash when destroying a QMediaPlayer We need to unload media before we delete the player. Task-number: QTBUG-37447 Change-Id: I09263214c425339c0d8c192091aeaa6e3fb5331f Reviewed-by: Yoann Lopes --- src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm index 9e0ac4f4..a73974cc 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm @@ -404,6 +404,8 @@ static void *AVFMediaPlayerSessionObserverCurrentItemObservationContext = &AVFMe #ifdef QT_DEBUG_AVF qDebug() << Q_FUNC_INFO; #endif + [self unloadMedia]; + if (m_player) { [m_player removeObserver:self forKeyPath:AVF_CURRENT_ITEM_KEY]; [m_player removeObserver:self forKeyPath:AVF_RATE_KEY]; @@ -416,8 +418,6 @@ static void *AVFMediaPlayerSessionObserverCurrentItemObservationContext = &AVFMe m_playerLayer = 0; } - [self unloadMedia]; - if (m_URL) { [m_URL release]; }