diff --git a/src/notifybyaudio.h b/src/notifybyaudio.h --- a/src/notifybyaudio.h +++ b/src/notifybyaudio.h @@ -27,6 +27,8 @@ #include +#include + namespace Phonon { // class MediaObject; class MediaSource; @@ -56,7 +58,7 @@ private: void finishNotification(KNotification *notification, Phonon::MediaObject *m); - QList m_reusablePhonons; + QSet m_reusablePhonons; QHash m_notifications; Phonon::AudioOutput *m_audioOutput; }; diff --git a/src/notifybyaudio.cpp b/src/notifybyaudio.cpp --- a/src/notifybyaudio.cpp +++ b/src/notifybyaudio.cpp @@ -87,7 +87,8 @@ connect(m, SIGNAL(stateChanged(Phonon::State,Phonon::State)), SLOT(stateChanged(Phonon::State,Phonon::State))); Phonon::createPath(m, m_audioOutput); } else { - m = m_reusablePhonons.takeFirst(); + m = *m_reusablePhonons.begin(); + m_reusablePhonons.erase(m_reusablePhonons.begin()); } m->setCurrentSource(soundURL); @@ -163,7 +164,8 @@ disconnect(m, SIGNAL(currentSourceChanged(Phonon::MediaSource)), this, SLOT(onAudioSourceChanged(Phonon::MediaSource))); - m_reusablePhonons.append(m); + // insert into reusable set, ensures we do not insert the same pointer twice + m_reusablePhonons.insert(m); } void NotifyByAudio::onAudioSourceChanged(const Phonon::MediaSource &source)