diff options
author | Bartosz Golaszewski <brgl@bgdev.pl> | 2017-07-05 12:45:00 +0200 |
---|---|---|
committer | Bartosz Golaszewski <brgl@bgdev.pl> | 2017-07-06 12:59:00 +0000 |
commit | 53538ff9492c5889db3bcbbbe17bc270d1e83cb1 (patch) | |
tree | 9708cc88ec61619f1b20216655711f9987a4163b | |
parent | 2b343affb7b16ff195bbc8139d2873b183292852 (diff) |
PulseAudio: fix a pthread_mutex crash in error path
QSoundEffect (pulseaudio) uses a workaround for stability issues:
although the pulseaudio mainloop mutex is recursive, it utilizes a
separate lock counting. This is not the best solution, but it is a
part of a larger set of changes which improved the stability in CI
under heavy load.
QSoundEffect always calls pa_threaded_mainloop_lock/unlock() from the
same thread so the additional lock counting works in normal situation
even though it doesn't use atomic types.
However if pa_context_connect() fails, pa_threaded_mainloop_unlock()
is called without regard to current lock count. This leads to random
double-unlock aborts if pa_context_connect() fails more than once
(e.g. after the reconnect scheduled from onContextFailed()).
Fix this by always using the PulseDaemon wrappers around
pa_threaded_mainloop_lock/unlock().
Task-number: QTBUG-61725
Change-Id: I41eb9a76892a6646fd5620ef8f686473b339464f
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r-- | src/multimedia/audio/qsoundeffect_pulse_p.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp index 3a3806155..1e9204598 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp @@ -181,7 +181,7 @@ private Q_SLOTS: if (m_context == 0) { qWarning("PulseAudioService: Unable to create new pulseaudio context"); - pa_threaded_mainloop_unlock(m_mainLoop); + unlock(); pa_threaded_mainloop_free(m_mainLoop); m_mainLoop = 0; onContextFailed(); @@ -193,7 +193,7 @@ private Q_SLOTS: if (pa_context_connect(m_context, 0, (pa_context_flags_t)0, 0) < 0) { qWarning("PulseAudioService: pa_context_connect() failed"); pa_context_unref(m_context); - pa_threaded_mainloop_unlock(m_mainLoop); + unlock(); pa_threaded_mainloop_free(m_mainLoop); m_mainLoop = 0; m_context = 0; |