From e760a6aae78f6a41ec0430c9e242b449a3a217a8 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Sat, 31 Jul 2021 06:05:57 +0200 Subject: PulseAudio: Call pa_stream_flush() with PulseDaemonLocker lock held The pa_stream_flush() must be called with pa_threaded_mainloop_lock() held, otherwise it is possible to corrupt internal PA state. The PulseDaemonLocker implements this lock and other pa_stream_flush() instances within qsoundeffect_pulse_p.cpp already instantiate the PulseDaemonLocker to claim the pa_threaded_mainloop_lock(). Add the missing locking to ::setVolume pa_stream_flush() call too. Change-Id: I667b1df669f839737c6cedb62ff66b612bdd65a0 Reviewed-by: Lars Knoll --- src/multimedia/audio/qsoundeffect_pulse_p.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/multimedia/audio') diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp index 5c15d4a6a..04c33a93e 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp @@ -552,8 +552,10 @@ void QSoundEffectPrivate::setVolume(qreal volume) m_volume = qBound(qreal(0), volume, qreal(1)); locker.unlock(); - if (!m_playing && m_pulseStream) + if (!m_playing && m_pulseStream) { + PulseDaemonLocker locker; pa_stream_flush(m_pulseStream, volume_stream_flush_callback, m_ref->getRef()); + } emit volumeChanged(); } -- cgit v1.2.3