d3d9: VertexDeclaration and VertexShader should keep reference to the parent device object.

This commit is contained in:
Vitaliy Margolen 2006-04-11 22:09:27 -06:00 committed by Alexandre Julliard
parent 99136998e2
commit 4a25828c0d
3 changed files with 10 additions and 0 deletions

View File

@ -541,6 +541,8 @@ typedef struct IDirect3DVertexDeclaration9Impl {
/* IDirect3DVertexDeclaration9 fields */ /* IDirect3DVertexDeclaration9 fields */
IWineD3DVertexDeclaration *wineD3DVertexDeclaration; IWineD3DVertexDeclaration *wineD3DVertexDeclaration;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DVertexDeclaration9Impl; } IDirect3DVertexDeclaration9Impl;
/* ---------------------- */ /* ---------------------- */
@ -563,6 +565,8 @@ typedef struct IDirect3DVertexShader9Impl {
/* IDirect3DVertexShader9 fields */ /* IDirect3DVertexShader9 fields */
IWineD3DVertexShader *wineD3DVertexShader; IWineD3DVertexShader *wineD3DVertexShader;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DVertexShader9Impl; } IDirect3DVertexShader9Impl;
/* --------------------- */ /* --------------------- */

View File

@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DVertexDeclaration9Impl_Release(LPDIRECT3DVERTEXDECLARATION
if (ref == 0) { if (ref == 0) {
IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration); IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;
@ -129,6 +130,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9
FIXME("(%p) call to IWineD3DDevice_CreateVertexDeclaration failed\n", This); FIXME("(%p) call to IWineD3DDevice_CreateVertexDeclaration failed\n", This);
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
} else { } else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppDecl = (LPDIRECT3DVERTEXDECLARATION9) object; *ppDecl = (LPDIRECT3DVERTEXDECLARATION9) object;
TRACE("(%p) : Created vertex declatanio %p\n", This, object); TRACE("(%p) : Created vertex declatanio %p\n", This, object);
} }

View File

@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DVertexShader9Impl_Release(LPDIRECT3DVERTEXSHADER9 iface) {
if (ref == 0) { if (ref == 0) {
IWineD3DVertexShader_Release(This->wineD3DVertexShader); IWineD3DVertexShader_Release(This->wineD3DVertexShader);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;
@ -122,6 +123,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9 iface,
FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n"); FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n");
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
}else{ }else{
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppShader = (IDirect3DVertexShader9 *)object; *ppShader = (IDirect3DVertexShader9 *)object;
TRACE("(%p) : Created vertex shader %p\n", This, object); TRACE("(%p) : Created vertex shader %p\n", This, object);
} }