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

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-12-02 12:02:39 +00:00 committed by Alexandre Julliard
parent 1acba9d959
commit 7b42697124
1 changed files with 8 additions and 5 deletions

View File

@ -1085,22 +1085,26 @@ 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;
}
hr = setup_oss_device(mode, This->fd, fmt, NULL);
if(FAILED(hr)){
LeaveCriticalSection(&This->lock);
LeaveCriticalSection(&g_sessions_lock);
return hr;
}
This->fmt = clone_format(fmt);
if(!This->fmt){
LeaveCriticalSection(&This->lock);
LeaveCriticalSection(&g_sessions_lock);
return E_OUTOFMEMORY;
}
@ -1116,6 +1120,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
CoTaskMemFree(This->fmt);
This->fmt = NULL;
LeaveCriticalSection(&This->lock);
LeaveCriticalSection(&g_sessions_lock);
return E_OUTOFMEMORY;
}
@ -1124,6 +1129,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
CoTaskMemFree(This->fmt);
This->fmt = NULL;
LeaveCriticalSection(&This->lock);
LeaveCriticalSection(&g_sessions_lock);
return E_OUTOFMEMORY;
}
@ -1134,27 +1140,24 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
This->flags = flags;
This->oss_bufsize_bytes = 0;
EnterCriticalSection(&g_sessions_lock);
hr = get_audio_session(sessionguid, This->parent, fmt->nChannels,
&This->session);
if(FAILED(hr)){
LeaveCriticalSection(&g_sessions_lock);
HeapFree(GetProcessHeap(), 0, This->vols);
This->vols = NULL;
CoTaskMemFree(This->fmt);
This->fmt = NULL;
LeaveCriticalSection(&This->lock);
LeaveCriticalSection(&g_sessions_lock);
return hr;
}
list_add_tail(&This->session->clients, &This->entry);
LeaveCriticalSection(&g_sessions_lock);
This->initted = TRUE;
LeaveCriticalSection(&This->lock);
LeaveCriticalSection(&g_sessions_lock);
return S_OK;
}