AVFoundation: Fix another crash when destroying a QMediaPlayer
authorAndy Nichols <andy.nichols@digia.com>
Wed, 12 Mar 2014 12:29:55 +0000 (13:29 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 14 Mar 2014 11:40:14 +0000 (12:40 +0100)
We need to unload media before we delete the player.

Task-number: QTBUG-37447
Change-Id: I09263214c425339c0d8c192091aeaa6e3fb5331f
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm

index 9e0ac4f..a73974c 100644 (file)
@@ -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];
     }