diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-24 15:33:53 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-24 15:35:41 (GMT) |
commit | 5ee3c7a120477668904502a997d88d0c5a0fd976 (patch) | |
tree | db363af27031fd719215c382e115b6272089c4c6 /src/3rdparty/phonon/ds9 | |
parent | cf354eb2bb24de1076f126c526317ac7e1d9ac4d (diff) | |
download | Qt-5ee3c7a120477668904502a997d88d0c5a0fd976.zip Qt-5ee3c7a120477668904502a997d88d0c5a0fd976.tar.gz Qt-5ee3c7a120477668904502a997d88d0c5a0fd976.tar.bz2 |
Phonon/ds9: fix a potential dead-lock found by user
This is following merge request 878. A customer was able to get a dead-
lock when calling at the same time RenderFile and enumerating the audio
devices. We now have a global mutex for that.
Diffstat (limited to 'src/3rdparty/phonon/ds9')
-rw-r--r-- | src/3rdparty/phonon/ds9/backend.cpp | 7 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/backend.h | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/mediaobject.cpp | 1 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/qpin.cpp | 1 |
4 files changed, 12 insertions, 1 deletions
diff --git a/src/3rdparty/phonon/ds9/backend.cpp b/src/3rdparty/phonon/ds9/backend.cpp index 6007020..6ed0145 100644 --- a/src/3rdparty/phonon/ds9/backend.cpp +++ b/src/3rdparty/phonon/ds9/backend.cpp @@ -64,6 +64,11 @@ namespace Phonon ::CoUninitialize(); } + QMutex *Backend::directShowMutex() + { + return &qobject_cast<Backend*>(qt_plugin_instance())->m_directShowMutex; + } + QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args) { switch (c) @@ -131,6 +136,7 @@ namespace Phonon QList<int> Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const { + QMutexLocker locker(&m_directShowMutex); QList<int> ret; switch(type) @@ -204,6 +210,7 @@ namespace Phonon QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const { + QMutexLocker locker(&m_directShowMutex); QHash<QByteArray, QVariant> ret; switch (type) { diff --git a/src/3rdparty/phonon/ds9/backend.h b/src/3rdparty/phonon/ds9/backend.h index ad638f2..9b2c2a2 100644 --- a/src/3rdparty/phonon/ds9/backend.h +++ b/src/3rdparty/phonon/ds9/backend.h @@ -23,6 +23,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <phonon/phononnamespace.h> #include <QtCore/QList> +#include <QtCore/QMutex> #include "compointer.h" #include "backendnode.h" @@ -63,6 +64,8 @@ namespace Phonon Filter getAudioOutputFilter(int index) const; + static QMutex *Backend::directShowMutex(); + Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); @@ -74,6 +77,7 @@ namespace Phonon }; mutable QVector<AudioMoniker> m_audioOutputs; mutable QVector<CLSID> m_audioEffects; + mutable QMutex m_directShowMutex; }; } } diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index 39fcaa0..579517f 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -177,6 +177,7 @@ namespace Phonon void WorkerThread::handleTask() { + QMutexLocker locker(Backend::directShowMutex()); { QMutexLocker locker(&m_mutex); if (m_finished || m_queue.isEmpty()) { diff --git a/src/3rdparty/phonon/ds9/qpin.cpp b/src/3rdparty/phonon/ds9/qpin.cpp index 8653db9..b4afd10 100644 --- a/src/3rdparty/phonon/ds9/qpin.cpp +++ b/src/3rdparty/phonon/ds9/qpin.cpp @@ -543,7 +543,6 @@ namespace Phonon FILTER_STATE QPin::filterState() const { - QMutexLocker locker(&m_mutex); FILTER_STATE fstate = State_Stopped; m_parent->GetState(0, &fstate); return fstate; |