diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c index 3f742fe3bff..53991ccce03 100644 --- a/dlls/d3d8/cubetexture.c +++ b/dlls/d3d8/cubetexture.c @@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 iface) { 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 29556d1a186..a66871b3b7a 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 eed71e5fe50..6cbbc270fb3 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -214,6 +214,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE8 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_CreateTexture(LPDIRECT3DDEVICE8 iface, UINT HeapFree(GetProcessHeap(), 0, object); /* *ppTexture = NULL; */ } else { + IUnknown_AddRef(iface); + object->parentDevice = iface; *ppTexture = (LPDIRECT3DTEXTURE8) object; } @@ -350,6 +354,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 iface, 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_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, U HeapFree(GetProcessHeap(), 0, object); *ppCubeTexture = NULL; } else { + IUnknown_AddRef(iface); + object->parentDevice = iface; *ppCubeTexture = (LPDIRECT3DCUBETEXTURE8) object; } @@ -452,6 +460,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(LPDIRECT3DDEVICE8 iface, U 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_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/indexbuffer.c b/dlls/d3d8/indexbuffer.c index 2f06cf9ffae..316e1ff880c 100644 --- a/dlls/d3d8/indexbuffer.c +++ b/dlls/d3d8/indexbuffer.c @@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 iface) { 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 583b7ec27b6..83b4c2f3de2 100644 --- a/dlls/d3d8/swapchain.c +++ b/dlls/d3d8/swapchain.c @@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface) { 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 c3794897074..273bd51f290 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface) { 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 f11e756fcd8..5bba7aafda0 100644 --- a/dlls/d3d8/vertexshader.c +++ b/dlls/d3d8/vertexshader.c @@ -56,7 +56,6 @@ ULONG WINAPI IDirect3DVertexShader8Impl_Release(IDirect3DVertexShader8 *iface) { 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 11cfaefe103..2377ae9fbde 100644 --- a/dlls/d3d8/volumetexture.c +++ b/dlls/d3d8/volumetexture.c @@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 iface) if (ref == 0) { IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture); + IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } return ref;