wined3d: Don't free D3D vertex shaders until the wined3d vertex shader is destroyed.
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 75e173f..b19f846 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1762,7 +1762,8 @@
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface,
const DWORD *pFunction, const struct wined3d_shader_signature *output_signature,
- IWineD3DVertexShader **ppVertexShader, IUnknown *parent)
+ IWineD3DVertexShader **ppVertexShader, IUnknown *parent,
+ const struct wined3d_parent_ops *parent_ops)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexShaderImpl *object;
@@ -1775,7 +1776,7 @@
return E_OUTOFMEMORY;
}
- hr = vertexshader_init(object, This, pFunction, output_signature, parent);
+ hr = vertexshader_init(object, This, pFunction, output_signature, parent, parent_ops);
if (FAILED(hr))
{
WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c
index ea700ba..0a5bf40 100644
--- a/dlls/wined3d/vertexshader.c
+++ b/dlls/wined3d/vertexshader.c
@@ -174,6 +174,7 @@
if (!refcount)
{
shader_cleanup((IWineD3DBaseShader *)iface);
+ This->parent_ops->wined3d_object_destroyed(This->parent);
HeapFree(GetProcessHeap(), 0, This);
}
@@ -355,7 +356,7 @@
HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
- IUnknown *parent)
+ IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
{
HRESULT hr;
@@ -363,6 +364,7 @@
shader->lpVtbl = &IWineD3DVertexShader_Vtbl;
shader->parent = parent;
+ shader->parent_ops = parent_ops;
shader_init(&shader->baseShader, (IWineD3DDevice *)device);
list_add_head(&device->shaders, &shader->baseShader.shader_list_entry);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 784b024..1c93b22 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2764,6 +2764,7 @@
/* IWineD3DVertexShaderImpl */
IUnknown *parent;
+ const struct wined3d_parent_ops *parent_ops;
/* The GL shader */
void *backend_priv;
@@ -2780,7 +2781,7 @@
struct vs_compile_args *args) DECLSPEC_HIDDEN;
HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
- IUnknown *parent) DECLSPEC_HIDDEN;
+ IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
/*****************************************************************************
* IDirect3DPixelShader implementation structure