d3d9: All objects created by device should keep reference to it.

This commit is contained in:
Vitaliy Margolen 2006-05-20 10:36:33 -06:00 committed by Alexandre Julliard
parent 1175a2f3a2
commit 6dcae77cc9
9 changed files with 57 additions and 18 deletions

View File

@ -60,6 +60,7 @@ ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 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;
@ -270,6 +271,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface,
FIXME("(%p) call to IWineD3DDevice_CreateCubeTexture failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
} else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppCubeTexture = (LPDIRECT3DCUBETEXTURE9) object;
TRACE("(%p) : Created cube texture %p\n", This, object);
}

View File

@ -270,6 +270,8 @@ typedef struct IDirect3DSwapChain9Impl
/* IDirect3DSwapChain9 fields */
IWineD3DSwapChain *wineD3DSwapChain;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DSwapChain9Impl;
/* ------------------ */
@ -379,6 +381,8 @@ typedef struct IDirect3DIndexBuffer9Impl
/* IDirect3DResource9 fields */
IWineD3DIndexBuffer *wineD3DIndexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DIndexBuffer9Impl;
/* --------------------- */
@ -444,11 +448,13 @@ typedef struct IDirect3DCubeTexture9Impl
{
/* IUnknown fields */
const IDirect3DCubeTexture9Vtbl *lpVtbl;
LONG ref;
LONG ref;
/* IDirect3DResource9 fields */
IWineD3DCubeTexture *wineD3DCubeTexture;
IWineD3DCubeTexture *wineD3DCubeTexture;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DCubeTexture9Impl;
@ -473,6 +479,8 @@ typedef struct IDirect3DTexture9Impl
/* IDirect3DResource9 fields */
IWineD3DTexture *wineD3DTexture;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DTexture9Impl;
/* ----------------------- */
@ -491,11 +499,13 @@ typedef struct IDirect3DVolumeTexture9Impl
{
/* IUnknown fields */
const IDirect3DVolumeTexture9Vtbl *lpVtbl;
LONG ref;
LONG ref;
/* IDirect3DResource9 fields */
IWineD3DVolumeTexture *wineD3DVolumeTexture;
IWineD3DVolumeTexture *wineD3DVolumeTexture;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DVolumeTexture9Impl;
/* ----------------------- */
@ -511,13 +521,15 @@ extern const IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl;
* IDirect3DStateBlock9 implementation structure
*/
typedef struct IDirect3DStateBlock9Impl {
/* IUnknown fields */
const IDirect3DStateBlock9Vtbl *lpVtbl;
LONG ref;
/* IUnknown fields */
const IDirect3DStateBlock9Vtbl *lpVtbl;
LONG ref;
/* IDirect3DStateBlock9 fields */
IWineD3DStateBlock *wineD3DStateBlock;
/* IDirect3DStateBlock9 fields */
IWineD3DStateBlock *wineD3DStateBlock;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DStateBlock9Impl;
@ -584,11 +596,13 @@ extern const IDirect3DPixelShader9Vtbl Direct3DPixelShader9_Vtbl;
typedef struct IDirect3DPixelShader9Impl {
/* IUnknown fields */
const IDirect3DPixelShader9Vtbl *lpVtbl;
LONG ref;
LONG ref;
/* IDirect3DPixelShader9 fields */
IWineD3DPixelShader *wineD3DPixelShader;
IWineD3DPixelShader *wineD3DPixelShader;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DPixelShader9Impl;
/* --------------- */
@ -610,7 +624,9 @@ typedef struct IDirect3DQuery9Impl {
/* IDirect3DQuery9 fields */
IWineD3DQuery *wineD3DQuery;
/* Parent reference */
LPDIRECT3DDEVICE9 parentDevice;
} IDirect3DQuery9Impl;

View File

@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DIndexBuffer9Impl_Release(LPDIRECT3DINDEXBUFFER9 iface) {
if (ref == 0) {
IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@ -180,6 +181,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface,
FIXME("(%p) call to IWineD3DDevice_CreateIndexBuffer failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
} else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppIndexBuffer = (LPDIRECT3DINDEXBUFFER9) object;
TRACE("(%p) : Created index buffer %p\n", This, object);
}

View File

@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DPixelShader9Impl_Release(LPDIRECT3DPIXELSHADER9 iface) {
if (ref == 0) {
IWineD3DPixelShader_Release(This->wineD3DPixelShader);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@ -123,6 +124,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9 iface, C
FIXME("(%p) call to IWineD3DDevice_CreatePixelShader failed\n", This);
HeapFree(GetProcessHeap(), 0 , object);
} else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppShader = (IDirect3DPixelShader9*) object;
TRACE("(%p) : Created pixel shader %p\n", This, object);
}

View File

@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DQuery9Impl_Release(LPDIRECT3DQUERY9 iface) {
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@ -145,6 +146,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUER
FIXME("(%p) call to IWineD3DDevice_CreateQuery failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
} else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppQuery = (LPDIRECT3DQUERY9) object;
TRACE("(%p) : Created query %p\n", This , object);
}

View File

@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface) {
if (ref == 0) {
IWineD3DStateBlock_Release(This->wineD3DStateBlock);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@ -116,8 +117,10 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9 iface, D3
FIXME("(%p) Call to IWineD3DDevice_CreateStateBlock failed.\n", This);
HeapFree(GetProcessHeap(), 0, object);
} else {
*ppStateBlock = (IDirect3DStateBlock9*)object;
TRACE("(%p) : Created stateblock %p\n", This, object);
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppStateBlock = (IDirect3DStateBlock9*)object;
TRACE("(%p) : Created stateblock %p\n", This, object);
}
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object);
return hrc;

View File

@ -58,6 +58,7 @@ ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface) {
if (ref == 0) {
IWineD3DSwapChain_Release(This->wineD3DSwapChain);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@ -192,7 +193,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
if (hrc != D3D_OK) {
FIXME("(%p) call to IWineD3DDevice_CreateAdditionalSwapChain failed\n", This);
HeapFree(GetProcessHeap(), 0 , object);
}else{
} else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*pSwapChain = (IDirect3DSwapChain9 *)object;
TRACE("(%p) : Created swapchain %p\n", This, *pSwapChain);
}

View File

@ -59,6 +59,7 @@ ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) {
if (ref == 0) {
IWineD3DTexture_Release(This->wineD3DTexture);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@ -263,7 +264,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UIN
FIXME("(%p) call to IWineD3DDevice_CreateTexture failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
} else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppTexture= (LPDIRECT3DTEXTURE9) object;
TRACE("(%p) Created Texture %p, %p\n", This, object, object->wineD3DTexture);
}

View File

@ -58,6 +58,7 @@ ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9 iface)
if (ref == 0) {
IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@ -267,6 +268,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9 ifac
FIXME("(%p) call to IWineD3DDevice_CreateVolumeTexture failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
} else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE9) object;
TRACE("(%p) : Created volume texture %p\n", This, object);
}