From b6b974361ab000be0585998dabfe8019ad6b39c1 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Wed, 5 Mar 2014 15:32:05 +0100 Subject: [PATCH] AVFoundation: Prevent Crash in QMediaPlayer Task-number: QTBUG-34213 Change-Id: I0883436175439abbb4ea964ed552a17b970ed05c Reviewed-by: Michael Bruning Reviewed-by: Yoann Lopes --- src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm index cf2ad30..9e0ac4f 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm @@ -133,7 +133,8 @@ static void *AVFMediaPlayerSessionObserverCurrentItemObservationContext = &AVFMe - (void) unloadMedia { - [m_player setRate:0.0]; + if (m_player) + [m_player setRate:0.0]; if (m_playerItem) { [m_playerItem removeObserver:self forKeyPath:AVF_STATUS_KEY]; @@ -407,10 +408,12 @@ static void *AVFMediaPlayerSessionObserverCurrentItemObservationContext = &AVFMe [m_player removeObserver:self forKeyPath:AVF_CURRENT_ITEM_KEY]; [m_player removeObserver:self forKeyPath:AVF_RATE_KEY]; [m_player release]; + m_player = 0; } if (m_playerLayer) { [m_playerLayer release]; + m_playerLayer = 0; } [self unloadMedia]; -- 2.7.4