From 350f97874544396a99cf82b47eb9a6e50838a88a Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 7 Oct 2009 14:29:06 +0200 Subject: Use QScopedPointer for AudioPlayer's CPlayerType. Reviewed-by: Gareth Stockwell --- src/3rdparty/phonon/mmf/audioplayer.cpp | 9 +++------ src/3rdparty/phonon/mmf/audioplayer.h | 5 ++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index 6c1fc68..ceaf305 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -34,14 +34,13 @@ using namespace Phonon::MMF; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::AudioPlayer::AudioPlayer() : m_player(0) +MMF::AudioPlayer::AudioPlayer() { construct(); } MMF::AudioPlayer::AudioPlayer(const AbstractPlayer& player) : AbstractMediaPlayer(player) - , m_player(0) { construct(); } @@ -51,7 +50,7 @@ void MMF::AudioPlayer::construct() TRACE_CONTEXT(AudioPlayer::AudioPlayer, EAudioApi); TRACE_ENTRY_0(); - TRAPD(err, m_player = CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone)); + TRAPD(err, m_player.reset(CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone))); if (KErrNone != err) { changeState(ErrorState); } @@ -64,8 +63,6 @@ MMF::AudioPlayer::~AudioPlayer() TRACE_CONTEXT(AudioPlayer::~AudioPlayer, EAudioApi); TRACE_ENTRY_0(); - delete m_player; - TRACE_EXIT_0(); } @@ -237,7 +234,7 @@ void MMF::AudioPlayer::MapcPlayComplete(TInt aError) CPlayerType *MMF::AudioPlayer::player() const { - return m_player; + return m_player.data(); } diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h index f16de1d..60ef436 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.h +++ b/src/3rdparty/phonon/mmf/audioplayer.h @@ -86,6 +86,9 @@ public: virtual void MapcPlayComplete(TInt aError); #endif + /** + * This class owns the pointer. + */ CPlayerType *player() const; private: @@ -96,7 +99,7 @@ private: * Using CPlayerType typedef in order to be able to easily switch between * CMdaAudioPlayerUtility and CDrmPlayerUtility */ - CPlayerType* m_player; + QScopedPointer m_player; }; } } -- cgit v0.12