When switching audio device on Linux with ALSA plugin, a deadlock in AlsaPlugin::open often occurs. m_deviceListMutex is supposed to be released after emitting AlsaPCMDevice::closed signal, but a connected slot is often not called.
As the signal is emitted from a different thread than a receiver is living, Qt::QueuedConnection is used by default. In such case the slot is called from the event loop of receiver object's thread. The thread is often blocked on locking mutex resulting in event loop not spinning and deadlock.
Connection type can be changed to Qt::DirectConnection so the slot is called immediately from the thread that emitted the signal. It should be safe as m_devices is protected by a mutex already.
This PR fixes #56 and also adds missing include in musicnoise.cpp that prevents from successful compilation on Linux.
When switching audio device on Linux with ALSA plugin, a deadlock in AlsaPlugin::open often occurs.
m_deviceListMutex
is supposed to be released after emittingAlsaPCMDevice::closed
signal, but a connected slot is often not called.As the signal is emitted from a different thread than a receiver is living,
Qt::QueuedConnection
is used by default. In such case the slot is called from the event loop of receiver object's thread. The thread is often blocked on locking mutex resulting in event loop not spinning and deadlock.Connection type can be changed to
Qt::DirectConnection
so the slot is called immediately from the thread that emitted the signal. It should be safe asm_devices
is protected by a mutex already.This PR fixes #56 and also adds missing include in
musicnoise.cpp
that prevents from successful compilation on Linux.