https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f336e915a21733e5d1306…
commit f336e915a21733e5d1306a766ce01b997e94cfd1
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Mon Sep 21 22:50:18 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Thu Feb 4 16:37:03 2021 +0100
[WINESYNC] d3dx9: Simplify effect cleanup.
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 009279845d9503468d5d3d39e393ad2ffa00181d by Matteo Bruni
<mbruni(a)codeweavers.com>
---
dll/directx/wine/d3dx9_36/effect.c | 39 ++++++++++----------------------------
sdk/tools/winesync/d3dx9.cfg | 2 +-
2 files changed, 11 insertions(+), 30 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c
index a3efbcef329..08e51298cd0 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -681,11 +681,11 @@ static void free_technique(struct d3dx_technique *technique)
technique->name = NULL;
}
-static void d3dx9_base_effect_cleanup(struct d3dx_effect *effect)
+static void d3dx_effect_cleanup(struct d3dx_effect *effect)
{
unsigned int i;
- TRACE("Effect %p.\n", effect);
+ TRACE("effect %p.\n", effect);
heap_free(effect->full_name_tmp);
@@ -694,7 +694,6 @@ static void d3dx9_base_effect_cleanup(struct d3dx_effect *effect)
for (i = 0; i < effect->parameter_count; ++i)
free_top_level_parameter(&effect->parameters[i]);
heap_free(effect->parameters);
- effect->parameters = NULL;
}
if (effect->techniques)
@@ -702,37 +701,23 @@ static void d3dx9_base_effect_cleanup(struct d3dx_effect *effect)
for (i = 0; i < effect->technique_count; ++i)
free_technique(&effect->techniques[i]);
heap_free(effect->techniques);
- effect->techniques = NULL;
}
if (effect->objects)
{
for (i = 0; i < effect->object_count; ++i)
- {
free_object(&effect->objects[i]);
- }
heap_free(effect->objects);
- effect->objects = NULL;
}
-}
-
-static void free_effect(struct d3dx_effect *effect)
-{
- TRACE("Free effect %p\n", effect);
-
- d3dx9_base_effect_cleanup(effect);
if (effect->pool)
- {
effect->pool->lpVtbl->Release(effect->pool);
- }
if (effect->manager)
- {
IUnknown_Release(effect->manager);
- }
IDirect3DDevice9_Release(effect->device);
+ heap_free(effect);
}
static void get_vector(struct d3dx_parameter *param, D3DXVECTOR4 *vector)
@@ -1826,18 +1811,15 @@ static ULONG WINAPI d3dx_effect_AddRef(ID3DXEffect *iface)
static ULONG WINAPI d3dx_effect_Release(ID3DXEffect *iface)
{
- struct d3dx_effect *This = impl_from_ID3DXEffect(iface);
- ULONG ref = InterlockedDecrement(&This->ref);
+ struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
+ ULONG refcount = InterlockedDecrement(&effect->ref);
- TRACE("(%p)->(): Release from %u\n", This, ref + 1);
+ TRACE("%p decreasing refcount to %u.\n", effect, refcount);
- if (!ref)
- {
- free_effect(This);
- HeapFree(GetProcessHeap(), 0, This);
- }
+ if (!refcount)
+ d3dx_effect_cleanup(effect);
- return ref;
+ return refcount;
}
/*** ID3DXBaseEffect methods ***/
@@ -6334,7 +6316,6 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct
IDirect3DDev
error_messages, pool_impl, skip_constants)))
{
FIXME("Failed to parse effect, hr %#x.\n", hr);
- free_effect(effect);
return hr;
}
@@ -6382,7 +6363,7 @@ HRESULT WINAPI D3DXCreateEffectEx(struct IDirect3DDevice9 *device,
const void *s
if (FAILED(hr))
{
WARN("Failed to create effect object.\n");
- HeapFree(GetProcessHeap(), 0, object);
+ d3dx_effect_cleanup(object);
return hr;
}
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 918cf38d8be..d8f6eaaad50 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h:
sdk/inc
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h:
sdk/include/dxsdk/d3dx9of.h,
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h:
sdk/include/dxsdk/d3dx9shape.h,
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h:
sdk/include/dxsdk/d3dx9xof.h}
-tags: {wine: 5fa06bbc302c0fdbf8a5e087b7f18445475add2a}
+tags: {wine: 009279845d9503468d5d3d39e393ad2ffa00181d}