Module: wine Branch: refs/heads/master Commit: 1cc318c5a6cbed745da3c6d8ff0c10c500cb6f6b URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=1cc318c5a6cbed745da3c6d8...
Author: Vitaliy Margolen wine-patch@kievinfo.com Date: Sat May 20 10:39:03 2006 -0600
d3d8: All objects created by device should keep reference to it.
---
dlls/d3d8/cubetexture.c | 1 + dlls/d3d8/d3d8_private.h | 18 +++++++++++++++--- dlls/d3d8/device.c | 12 ++++++++++-- dlls/d3d8/indexbuffer.c | 1 + dlls/d3d8/swapchain.c | 1 + dlls/d3d8/texture.c | 1 + dlls/d3d8/vertexshader.c | 1 - dlls/d3d8/volumetexture.c | 1 + 8 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c index 3f742fe..53991cc 100644 --- a/dlls/d3d8/cubetexture.c +++ b/dlls/d3d8/cubetexture.c @@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DCubeTexture8Impl_R if (ref == 0) { TRACE("Releasing child %p\n", This->wineD3DCubeTexture); IWineD3DCubeTexture_Release(This->wineD3DCubeTexture); + IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } return ref; diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 29556d1..a66871b 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -229,6 +229,9 @@ struct IDirect3DSwapChain8Impl
/* IDirect3DSwapChain8 fields */ IWineD3DSwapChain *wineD3DSwapChain; + + /* Parent reference */ + LPDIRECT3DDEVICE8 parentDevice; };
/* ----------------- */ @@ -321,6 +324,9 @@ struct IDirect3DIndexBuffer8Impl
/* IDirect3DResource8 fields */ IWineD3DIndexBuffer *wineD3DIndexBuffer; + + /* Parent reference */ + LPDIRECT3DDEVICE8 parentDevice; };
/* --------------------- */ @@ -360,6 +366,9 @@ struct IDirect3DCubeTexture8Impl
/* IDirect3DResource8 fields */ IWineD3DCubeTexture *wineD3DCubeTexture; + + /* Parent reference */ + LPDIRECT3DDEVICE8 parentDevice; };
/* ----------------- */ @@ -382,6 +391,9 @@ struct IDirect3DTexture8Impl
/* IDirect3DResourc8 fields */ IWineD3DTexture *wineD3DTexture; + + /* Parent reference */ + LPDIRECT3DDEVICE8 parentDevice; };
/* ----------------------- */ @@ -404,6 +416,9 @@ struct IDirect3DVolumeTexture8Impl
/* IDirect3DResource8 fields */ IWineD3DVolumeTexture *wineD3DVolumeTexture; + + /* Parent reference */ + LPDIRECT3DDEVICE8 parentDevice; };
/* ----------------------- */ @@ -532,9 +547,6 @@ struct IDirect3DVertexShader8Impl { LONG ref;
IWineD3DVertexShader *wineD3DVertexShader; - - /* Parent reference */ - LPDIRECT3DDEVICE8 parentDevice; };
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index eed71e5..6cbbc27 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -214,6 +214,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_Crea HeapFree(GetProcessHeap(), 0 , object); *pSwapChain = NULL; }else{ + IUnknown_AddRef(iface); + object->parentDevice = iface; *pSwapChain = (IDirect3DSwapChain8 *)object; } TRACE("(%p) returning %p\n", This, *pSwapChain); @@ -312,6 +314,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_Crea HeapFree(GetProcessHeap(), 0, object); /* *ppTexture = NULL; */ } else { + IUnknown_AddRef(iface); + object->parentDevice = iface; *ppTexture = (LPDIRECT3DTEXTURE8) object; }
@@ -350,6 +354,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_Crea HeapFree(GetProcessHeap(), 0, object); *ppVolumeTexture = NULL; } else { + IUnknown_AddRef(iface); + object->parentDevice = iface; *ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE8) object; } TRACE("(%p) returning %p\n", This , *ppVolumeTexture); @@ -387,6 +393,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_Crea HeapFree(GetProcessHeap(), 0, object); *ppCubeTexture = NULL; } else { + IUnknown_AddRef(iface); + object->parentDevice = iface; *ppCubeTexture = (LPDIRECT3DCUBETEXTURE8) object; }
@@ -452,6 +460,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_Crea HeapFree(GetProcessHeap(), 0, object); *ppIndexBuffer = NULL; } else { + IUnknown_AddRef(iface); + object->parentDevice = iface; *ppIndexBuffer = (LPDIRECT3DINDEXBUFFER8)object; } return hrc; @@ -1071,8 +1081,6 @@ HRESULT WINAPI IDirect3DDevice8Impl_Crea 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/indexbuffer.c b/dlls/d3d8/indexbuffer.c index 2f06cf9..316e1ff 100644 --- a/dlls/d3d8/indexbuffer.c +++ b/dlls/d3d8/indexbuffer.c @@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DIndexBuffer8Impl_R
if (ref == 0) { IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer); + IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } return ref; diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c index 583b7ec..83b4c2f 100644 --- a/dlls/d3d8/swapchain.c +++ b/dlls/d3d8/swapchain.c @@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DSwapChain8Impl_Rel
if (ref == 0) { IWineD3DSwapChain_Release(This->wineD3DSwapChain); + IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } return ref; diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index c379489..273bd51 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DTexture8Impl_Relea
if (ref == 0) { IWineD3DTexture_Release(This->wineD3DTexture); + IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } return ref; diff --git a/dlls/d3d8/vertexshader.c b/dlls/d3d8/vertexshader.c index f11e756..5bba7aa 100644 --- a/dlls/d3d8/vertexshader.c +++ b/dlls/d3d8/vertexshader.c @@ -56,7 +56,6 @@ ULONG WINAPI IDirect3DVertexShader8Impl_
if (ref == 0) { IWineD3DVertexShader_Release(This->wineD3DVertexShader); - IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } return ref; diff --git a/dlls/d3d8/volumetexture.c b/dlls/d3d8/volumetexture.c index 11cfaef..2377ae9 100644 --- a/dlls/d3d8/volumetexture.c +++ b/dlls/d3d8/volumetexture.c @@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DVolumeTexture8Impl
if (ref == 0) { IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture); + IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } return ref;