diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-10-06 14:07:10 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-10-06 14:44:19 (GMT) |
commit | 54645071fad98b46a44d88b50095dc21ff63fff6 (patch) | |
tree | aa7c2b01fb7a9113c8854088c6be07c469869259 /src/3rdparty/phonon | |
parent | 0981f27d76436f8058d8534b7454777910922ee0 (diff) | |
download | Qt-54645071fad98b46a44d88b50095dc21ff63fff6.zip Qt-54645071fad98b46a44d88b50095dc21ff63fff6.tar.gz Qt-54645071fad98b46a44d88b50095dc21ff63fff6.tar.bz2 |
Fix crash related to audio equalizer.
The constructor initializer relied on member variables.
Task-number: QTBUG-4689
Diffstat (limited to 'src/3rdparty/phonon')
-rw-r--r-- | src/3rdparty/phonon/mmf/audioequalizer.cpp | 28 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/audioequalizer.h | 3 |
2 files changed, 14 insertions, 17 deletions
diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index c691e1e..7cc9bc7 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -36,18 +36,16 @@ void AudioEqualizer::parameterChanged(const int pid, { // There is no way to return an error from this function, so we just // have to trap and ignore exceptions. - TRAP_IGNORE(eq()->SetBandLevelL(pid, value.toInt())); + TRAP_IGNORE(static_cast<CAudioEqualizer *>(m_effect.data())->SetBandLevelL(pid, value.toInt())); } bool AudioEqualizer::activateOn(CPlayerType *player) { - m_effect.reset(CAudioEqualizer::NewL(*player)); - return true; -} + CAudioEqualizer *ptr = 0; + QT_TRAP_THROWING(ptr = CAudioEqualizer::NewL(*player)); + m_effect.reset(ptr); -CAudioEqualizer *AudioEqualizer::eq() const -{ - return static_cast<CAudioEqualizer *>(m_effect.data()); + return true; } QList<EffectParameter> AudioEqualizer::createParams() @@ -57,18 +55,21 @@ QList<EffectParameter> AudioEqualizer::createParams() // We temporarily create an AudioPlayer, and run the effect on it, so // we can extract the readonly data we need. AudioPlayer dummyPlayer; - activateOn(dummyPlayer.player()); + + CAudioEqualizer *eqPtr = 0; + QT_TRAP_THROWING(eqPtr = CAudioEqualizer::NewL(*dummyPlayer.player());) + QScopedPointer<CAudioEqualizer> e(eqPtr); TInt32 dbMin; TInt32 dbMax; - eq()->DbLevelLimits(dbMin, dbMax); + e->DbLevelLimits(dbMin, dbMax); - const int bandCount = eq()->NumberOfBands(); + const int bandCount = e->NumberOfBands(); for (int i = 0; i < bandCount; ++i) { - const qint32 hz = eq()->CenterFrequency(i); + const qint32 hz = e->CenterFrequency(i); - const qint32 defVol = eq()->BandLevel(i); + const qint32 defVol = e->BandLevel(i); retval.append(EffectParameter(i, tr("Frequency band, %1 Hz").arg(hz), @@ -80,10 +81,7 @@ QList<EffectParameter> AudioEqualizer::createParams() QString())); } - m_effect.reset(); - return retval; } QT_END_NAMESPACE - diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h index 6415411..d4c8165 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.h +++ b/src/3rdparty/phonon/mmf/audioequalizer.h @@ -49,8 +49,7 @@ protected: virtual bool activateOn(CPlayerType *player); private: - inline CAudioEqualizer *eq() const; - QList<EffectParameter> createParams(); + static QList<EffectParameter> createParams(); QScopedPointer<CAudioEqualizer> m_bassBoost; }; } |