From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d8/swapchain.c | 8 ++------ dlls/d3d9/swapchain.c | 8 ++------ dlls/wined3d/swapchain.c | 2 ++ 3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c index c137d0ded0bb..6e8b98e3b6de 100644 --- a/dlls/d3d8/swapchain.c +++ b/dlls/d3d8/swapchain.c @@ -171,12 +171,8 @@ static HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_devi swapchain->IDirect3DSwapChain8_iface.lpVtbl = &d3d8_swapchain_vtbl; swapchain->swap_interval = swap_interval;
- wined3d_mutex_lock(); - hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain, - &d3d8_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain); - wined3d_mutex_unlock(); - - if (FAILED(hr)) + if (FAILED(hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain, + &d3d8_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain))) { WARN("Failed to create wined3d swapchain, hr %#x.\n", hr); return hr; diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c index 5bd16bad5a7d..1279663dd52b 100644 --- a/dlls/d3d9/swapchain.c +++ b/dlls/d3d9/swapchain.c @@ -371,12 +371,8 @@ static HRESULT swapchain_init(struct d3d9_swapchain *swapchain, struct d3d9_devi swapchain->IDirect3DSwapChain9Ex_iface.lpVtbl = &d3d9_swapchain_vtbl; swapchain->swap_interval = swap_interval;
- wined3d_mutex_lock(); - hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain, - &d3d9_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain); - wined3d_mutex_unlock(); - - if (FAILED(hr)) + if (FAILED(hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain, + &d3d9_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain))) { WARN("Failed to create wined3d swapchain, hr %#x.\n", hr); return hr; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index ed8a3b3aca5f..60ef6ad78c9c 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1030,7 +1030,9 @@ HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, struct win if (!(object = heap_alloc_zero(sizeof(*object)))) return E_OUTOFMEMORY;
+ wined3d_mutex_lock(); hr = swapchain_init(object, device, desc, parent, parent_ops); + wined3d_mutex_unlock(); if (FAILED(hr)) { WARN("Failed to initialize swapchain, hr %#x.\n", hr);