Commit 1acba9d9 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winealsa: Don't acquire the sessions lock after the client lock.

This could lead to a deadlock with AudioSessionControl_GetState() which acquires the locks in the other order. Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8e0b337d
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment