From 99136998e2345ac5e2408f5f129c4b5d11db6c5a Mon Sep 17 00:00:00 2001 From: Vitaliy Margolen Date: Tue, 11 Apr 2006 22:09:27 -0600 Subject: [PATCH] d3d8: VertexShader should keep reference to the parent device object. --- dlls/d3d8/d3d8_private.h | 3 +++ dlls/d3d8/device.c | 2 ++ dlls/d3d8/vertexshader.c | 1 + 3 files changed, 6 insertions(+) diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index c0f8eb06df7..77a73c9a2ec 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -531,6 +531,9 @@ struct IDirect3DVertexShader8Impl { LONG ref; IWineD3DVertexShader *wineD3DVertexShader; + + /* Parent reference */ + LPDIRECT3DDEVICE8 parentDevice; }; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 01764597071..259049898eb 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1070,6 +1070,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8 iface, FIXME("(%p) : Number of shaders exceeds the maximum number of possible shaders\n", This); hrc = E_OUTOFMEMORY; } else { + IUnknown_AddRef(iface); + object->parentDevice = iface; This->vShaders[i] = object; *ppShader = i + VS_HIGHESTFIXEDFXF + 1; } diff --git a/dlls/d3d8/vertexshader.c b/dlls/d3d8/vertexshader.c index 5bba7aafda0..f11e756fcd8 100644 --- a/dlls/d3d8/vertexshader.c +++ b/dlls/d3d8/vertexshader.c @@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DVertexShader8Impl_Release(IDirect3DVertexShader8 *iface) { if (ref == 0) { IWineD3DVertexShader_Release(This->wineD3DVertexShader); + IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } return ref;