summaryrefslogtreecommitdiff
path: root/src/multimedia/audio/qsoundeffect_pulse_p.h
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2017-12-18 09:41:16 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2017-12-19 14:51:14 +0000
commit1083ed94683c3356f9ee19210cfe9b0dd53e4815 (patch)
tree226eadae12cef1a284c9b073375fb6a089dfbe16 /src/multimedia/audio/qsoundeffect_pulse_p.h
parent93630cd621b472d73fc8456ca396cda012a1aee0 (diff)
downloadqtmultimedia-1083ed94683c3356f9ee19210cfe9b0dd53e4815.tar.gz
PulseAudio: Fix deadlock for QSoundEffect in setMuted, setVolume
The deadlock would happen when one of the protected functions were reentered, as the lock used was not recursive. Since reading and writing to the volume and muted properties don't happen that often, the rw-mutex was replaced by a normal non-recursive mutex, which is now unlocked before the property changed signal is emitted. Task-number: QTBUG-65220 Change-Id: I1a224e9ff03f14593a854a7c1049c8a0445e29e6 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/multimedia/audio/qsoundeffect_pulse_p.h')
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h
index 7be88c55a..268a99326 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.h
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.h
@@ -56,7 +56,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qdatetime.h>
-#include <QtCore/qreadwritelock.h>
+#include <QtCore/qmutex.h>
#include <qmediaplayer.h>
#include <pulse/pulseaudio.h>
#include "qsamplecache_p.h"
@@ -175,7 +175,8 @@ private:
bool m_resourcesAvailable;
- mutable QReadWriteLock m_volumeLock;
+ // Protects volume while PuseAudio is accessing it
+ mutable QMutex m_volumeLock;
QMediaPlayerResourceSetInterface *m_resources;
};