=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Lock wined3d mutex in wined3d_swapchain_decref().
Alexandre Julliard
julliard at winehq.org
Thu Nov 29 15:33:01 CST 2018
Module: wine
Branch: master
Commit: 56d2db81b3b9b735bc6578f343197ca5d3c0c85d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=56d2db81b3b9b735bc6578f343197ca5d3c0c85d
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Thu Nov 29 14:33:45 2018 +0100
wined3d: Lock wined3d mutex in wined3d_swapchain_decref().
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d8/swapchain.c | 2 --
dlls/d3d9/swapchain.c | 2 --
dlls/dxgi/swapchain.c | 2 --
dlls/wined3d/swapchain.c | 7 ++++++-
4 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c
index 92ec011..c137d0d 100644
--- a/dlls/d3d8/swapchain.c
+++ b/dlls/d3d8/swapchain.c
@@ -74,9 +74,7 @@ static ULONG WINAPI d3d8_swapchain_Release(IDirect3DSwapChain8 *iface)
{
IDirect3DDevice8 *parent_device = swapchain->parent_device;
- wined3d_mutex_lock();
wined3d_swapchain_decref(swapchain->wined3d_swapchain);
- wined3d_mutex_unlock();
if (parent_device)
IDirect3DDevice8_Release(parent_device);
diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c
index 81d5605..5bd16ba 100644
--- a/dlls/d3d9/swapchain.c
+++ b/dlls/d3d9/swapchain.c
@@ -124,9 +124,7 @@ static ULONG WINAPI d3d9_swapchain_Release(IDirect3DSwapChain9Ex *iface)
{
IDirect3DDevice9Ex *parent_device = swapchain->parent_device;
- wined3d_mutex_lock();
wined3d_swapchain_decref(swapchain->wined3d_swapchain);
- wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */
if (parent_device)
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 914ba48..4dfa068 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -168,9 +168,7 @@ static ULONG STDMETHODCALLTYPE d3d11_swapchain_Release(IDXGISwapChain1 *iface)
}
if (swapchain->factory)
IDXGIFactory_Release(swapchain->factory);
- wined3d_mutex_lock();
wined3d_swapchain_decref(swapchain->wined3d_swapchain);
- wined3d_mutex_unlock();
if (device)
IWineDXGIDevice_Release(device);
}
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 2170629..ed8a3b3 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -109,17 +109,22 @@ ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
{
ULONG refcount = InterlockedDecrement(&swapchain->ref);
+ struct wined3d_device *device;
TRACE("%p decreasing refcount to %u.\n", swapchain, refcount);
if (!refcount)
{
- struct wined3d_device *device = swapchain->device;
+ wined3d_mutex_lock();
+ device = swapchain->device;
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
swapchain_cleanup(swapchain);
swapchain->parent_ops->wined3d_object_destroyed(swapchain->parent);
+
+ wined3d_mutex_unlock();
+
heap_free(swapchain);
}
More information about the wine-cvs
mailing list