summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-10-06 14:07:10 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-10-07 03:02:35 (GMT)
commit559ed56d3036418470682ed8cc662f26373ee868 (patch)
tree1c71da6013ff73a5a061c57b082d6a94ec3f327b
parent137d200704b31e3488fc9580e936eb17e9dc9793 (diff)
downloadQt-559ed56d3036418470682ed8cc662f26373ee868.zip
Qt-559ed56d3036418470682ed8cc662f26373ee868.tar.gz
Qt-559ed56d3036418470682ed8cc662f26373ee868.tar.bz2
Fix crash related to audio equalizer.
The constructor initializer relied on member variables. Task-number: QTBUG-4689 (cherry picked from commit 54645071fad98b46a44d88b50095dc21ff63fff6)
-rw-r--r--src/3rdparty/phonon/mmf/audioequalizer.cpp28
-rw-r--r--src/3rdparty/phonon/mmf/audioequalizer.h3
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;
};
}