Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Thu, Dec 02, 2021 at 12:02:38PM +0000, Huw Davies wrote:
This could lead to a deadlock with AudioSessionControl_GetState() which acquires the locks in the other order.
Signed-off-by: Huw Davies huw@codeweavers.com
dlls/winealsa.drv/mmdevdrv.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 7f25cdcce1b..5aa1b4aab63 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -1344,10 +1344,12 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, } }
EnterCriticalSection(&g_sessions_lock); EnterCriticalSection(&This->lock);
if(This->initted){ LeaveCriticalSection(&This->lock);
LeaveCriticalSection(&g_sessions_lock); return AUDCLNT_E_ALREADY_INITIALIZED;
}
@@ -1537,19 +1539,13 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, This->share = mode; This->flags = flags;
- EnterCriticalSection(&g_sessions_lock);
- hr = get_audio_session(sessionguid, This->parent, fmt->nChannels, &This->session);
- if(FAILED(hr)){
LeaveCriticalSection(&g_sessions_lock);
- if(FAILED(hr)) goto exit;
}
list_add_tail(&This->session->clients, &This->entry);
LeaveCriticalSection(&g_sessions_lock);
This->initted = TRUE;
TRACE("ALSA period: %lu frames\n", This->alsa_period_frames);
@@ -1569,6 +1565,7 @@ exit: }
LeaveCriticalSection(&This->lock);
LeaveCriticalSection(&g_sessions_lock);
return hr;
}
2.23.0