From 5ee3c7a120477668904502a997d88d0c5a0fd976 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 24 Aug 2009 17:33:53 +0200 Subject: 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. --- src/3rdparty/phonon/ds9/backend.cpp | 7 +++++++ src/3rdparty/phonon/ds9/backend.h | 4 ++++ src/3rdparty/phonon/ds9/mediaobject.cpp | 1 + src/3rdparty/phonon/ds9/qpin.cpp | 1 - 4 files changed, 12 insertions(+), 1 deletion(-) 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(qt_plugin_instance())->m_directShowMutex; + } + QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList &args) { switch (c) @@ -131,6 +136,7 @@ namespace Phonon QList Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const { + QMutexLocker locker(&m_directShowMutex); QList ret; switch(type) @@ -204,6 +210,7 @@ namespace Phonon QHash Backend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const { + QMutexLocker locker(&m_directShowMutex); QHash 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 . #include #include +#include #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 m_audioOutputs; mutable QVector 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; -- cgit v0.12