Commit 08c9b7c9 authored by Jan Sikorski's avatar Jan Sikorski Committed by Alexandre Julliard

d3d9: Don't grab wined3d lock for wined3d incref/decref functions.

parent 00824a94
...@@ -2553,9 +2553,7 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire ...@@ -2553,9 +2553,7 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
{ {
wined3d_mutex_lock();
wined3d_stateblock_decref(wined3d_stateblock); wined3d_stateblock_decref(wined3d_stateblock);
wined3d_mutex_unlock();
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -2563,9 +2561,7 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire ...@@ -2563,9 +2561,7 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize stateblock, hr %#x.\n", hr); WARN("Failed to initialize stateblock, hr %#x.\n", hr);
wined3d_mutex_lock();
wined3d_stateblock_decref(wined3d_stateblock); wined3d_stateblock_decref(wined3d_stateblock);
wined3d_mutex_unlock();
heap_free(object); heap_free(object);
return hr; return hr;
} }
......
...@@ -81,9 +81,7 @@ static ULONG WINAPI d3d9_Release(IDirect3D9Ex *iface) ...@@ -81,9 +81,7 @@ static ULONG WINAPI d3d9_Release(IDirect3D9Ex *iface)
if (!refcount) if (!refcount)
{ {
wined3d_mutex_lock();
wined3d_decref(d3d9->wined3d); wined3d_decref(d3d9->wined3d);
wined3d_mutex_unlock();
heap_free(d3d9->wined3d_outputs); heap_free(d3d9->wined3d_outputs);
heap_free(d3d9); heap_free(d3d9);
......
...@@ -76,10 +76,7 @@ static ULONG WINAPI d3d9_query_Release(IDirect3DQuery9 *iface) ...@@ -76,10 +76,7 @@ static ULONG WINAPI d3d9_query_Release(IDirect3DQuery9 *iface)
if (!refcount) if (!refcount)
{ {
wined3d_mutex_lock();
wined3d_query_decref(query->wined3d_query); wined3d_query_decref(query->wined3d_query);
wined3d_mutex_unlock();
IDirect3DDevice9Ex_Release(query->parent_device); IDirect3DDevice9Ex_Release(query->parent_device);
heap_free(query); heap_free(query);
} }
......
...@@ -54,9 +54,7 @@ static ULONG WINAPI d3d9_vertexshader_AddRef(IDirect3DVertexShader9 *iface) ...@@ -54,9 +54,7 @@ static ULONG WINAPI d3d9_vertexshader_AddRef(IDirect3DVertexShader9 *iface)
if (refcount == 1) if (refcount == 1)
{ {
IDirect3DDevice9Ex_AddRef(shader->parent_device); IDirect3DDevice9Ex_AddRef(shader->parent_device);
wined3d_mutex_lock();
wined3d_shader_incref(shader->wined3d_shader); wined3d_shader_incref(shader->wined3d_shader);
wined3d_mutex_unlock();
} }
return refcount; return refcount;
...@@ -72,11 +70,7 @@ static ULONG WINAPI d3d9_vertexshader_Release(IDirect3DVertexShader9 *iface) ...@@ -72,11 +70,7 @@ static ULONG WINAPI d3d9_vertexshader_Release(IDirect3DVertexShader9 *iface)
if (!refcount) if (!refcount)
{ {
IDirect3DDevice9Ex *device = shader->parent_device; IDirect3DDevice9Ex *device = shader->parent_device;
wined3d_mutex_lock();
wined3d_shader_decref(shader->wined3d_shader); wined3d_shader_decref(shader->wined3d_shader);
wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */ /* Release the device last, as it may cause the device to be destroyed. */
IDirect3DDevice9Ex_Release(device); IDirect3DDevice9Ex_Release(device);
} }
...@@ -203,9 +197,7 @@ static ULONG WINAPI d3d9_pixelshader_AddRef(IDirect3DPixelShader9 *iface) ...@@ -203,9 +197,7 @@ static ULONG WINAPI d3d9_pixelshader_AddRef(IDirect3DPixelShader9 *iface)
if (refcount == 1) if (refcount == 1)
{ {
IDirect3DDevice9Ex_AddRef(shader->parent_device); IDirect3DDevice9Ex_AddRef(shader->parent_device);
wined3d_mutex_lock();
wined3d_shader_incref(shader->wined3d_shader); wined3d_shader_incref(shader->wined3d_shader);
wined3d_mutex_unlock();
} }
return refcount; return refcount;
...@@ -221,11 +213,7 @@ static ULONG WINAPI d3d9_pixelshader_Release(IDirect3DPixelShader9 *iface) ...@@ -221,11 +213,7 @@ static ULONG WINAPI d3d9_pixelshader_Release(IDirect3DPixelShader9 *iface)
if (!refcount) if (!refcount)
{ {
IDirect3DDevice9Ex *device = shader->parent_device; IDirect3DDevice9Ex *device = shader->parent_device;
wined3d_mutex_lock();
wined3d_shader_decref(shader->wined3d_shader); wined3d_shader_decref(shader->wined3d_shader);
wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */ /* Release the device last, as it may cause the device to be destroyed. */
IDirect3DDevice9Ex_Release(device); IDirect3DDevice9Ex_Release(device);
} }
......
...@@ -66,9 +66,7 @@ static ULONG WINAPI d3d9_stateblock_Release(IDirect3DStateBlock9 *iface) ...@@ -66,9 +66,7 @@ static ULONG WINAPI d3d9_stateblock_Release(IDirect3DStateBlock9 *iface)
if (!refcount) if (!refcount)
{ {
wined3d_mutex_lock();
wined3d_stateblock_decref(stateblock->wined3d_stateblock); wined3d_stateblock_decref(stateblock->wined3d_stateblock);
wined3d_mutex_unlock();
IDirect3DDevice9Ex_Release(stateblock->parent_device); IDirect3DDevice9Ex_Release(stateblock->parent_device);
heap_free(stateblock); heap_free(stateblock);
......
...@@ -225,9 +225,7 @@ static ULONG WINAPI d3d9_vertex_declaration_AddRef(IDirect3DVertexDeclaration9 * ...@@ -225,9 +225,7 @@ static ULONG WINAPI d3d9_vertex_declaration_AddRef(IDirect3DVertexDeclaration9 *
if (refcount == 1) if (refcount == 1)
{ {
IDirect3DDevice9Ex_AddRef(declaration->parent_device); IDirect3DDevice9Ex_AddRef(declaration->parent_device);
wined3d_mutex_lock();
wined3d_vertex_declaration_incref(declaration->wined3d_declaration); wined3d_vertex_declaration_incref(declaration->wined3d_declaration);
wined3d_mutex_unlock();
} }
return refcount; return refcount;
...@@ -243,9 +241,7 @@ static ULONG WINAPI d3d9_vertex_declaration_Release(IDirect3DVertexDeclaration9 ...@@ -243,9 +241,7 @@ static ULONG WINAPI d3d9_vertex_declaration_Release(IDirect3DVertexDeclaration9
if (!refcount) if (!refcount)
{ {
IDirect3DDevice9Ex *parent_device = declaration->parent_device; IDirect3DDevice9Ex *parent_device = declaration->parent_device;
wined3d_mutex_lock();
wined3d_vertex_declaration_decref(declaration->wined3d_declaration); wined3d_vertex_declaration_decref(declaration->wined3d_declaration);
wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */ /* Release the device last, as it may cause the device to be destroyed. */
IDirect3DDevice9Ex_Release(parent_device); IDirect3DDevice9Ex_Release(parent_device);
......
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