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

This commit is contained in:
Vitaliy Margolen 2006-05-20 10:39:03 -06:00 committed by Alexandre Julliard
parent 17662eac6c
commit 1cc318c5a6
8 changed files with 30 additions and 6 deletions

View File

@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 iface) {
if (ref == 0) { if (ref == 0) {
TRACE("Releasing child %p\n", This->wineD3DCubeTexture); TRACE("Releasing child %p\n", This->wineD3DCubeTexture);
IWineD3DCubeTexture_Release(This->wineD3DCubeTexture); IWineD3DCubeTexture_Release(This->wineD3DCubeTexture);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;

View File

@ -229,6 +229,9 @@ struct IDirect3DSwapChain8Impl
/* IDirect3DSwapChain8 fields */ /* IDirect3DSwapChain8 fields */
IWineD3DSwapChain *wineD3DSwapChain; IWineD3DSwapChain *wineD3DSwapChain;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
}; };
/* ----------------- */ /* ----------------- */
@ -321,6 +324,9 @@ struct IDirect3DIndexBuffer8Impl
/* IDirect3DResource8 fields */ /* IDirect3DResource8 fields */
IWineD3DIndexBuffer *wineD3DIndexBuffer; IWineD3DIndexBuffer *wineD3DIndexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
}; };
/* --------------------- */ /* --------------------- */
@ -360,6 +366,9 @@ struct IDirect3DCubeTexture8Impl
/* IDirect3DResource8 fields */ /* IDirect3DResource8 fields */
IWineD3DCubeTexture *wineD3DCubeTexture; IWineD3DCubeTexture *wineD3DCubeTexture;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
}; };
/* ----------------- */ /* ----------------- */
@ -382,6 +391,9 @@ struct IDirect3DTexture8Impl
/* IDirect3DResourc8 fields */ /* IDirect3DResourc8 fields */
IWineD3DTexture *wineD3DTexture; IWineD3DTexture *wineD3DTexture;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
}; };
/* ----------------------- */ /* ----------------------- */
@ -404,6 +416,9 @@ struct IDirect3DVolumeTexture8Impl
/* IDirect3DResource8 fields */ /* IDirect3DResource8 fields */
IWineD3DVolumeTexture *wineD3DVolumeTexture; IWineD3DVolumeTexture *wineD3DVolumeTexture;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
}; };
/* ----------------------- */ /* ----------------------- */
@ -532,9 +547,6 @@ struct IDirect3DVertexShader8Impl {
LONG ref; LONG ref;
IWineD3DVertexShader *wineD3DVertexShader; IWineD3DVertexShader *wineD3DVertexShader;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
}; };

View File

@ -214,6 +214,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE8
HeapFree(GetProcessHeap(), 0 , object); HeapFree(GetProcessHeap(), 0 , object);
*pSwapChain = NULL; *pSwapChain = NULL;
}else{ }else{
IUnknown_AddRef(iface);
object->parentDevice = iface;
*pSwapChain = (IDirect3DSwapChain8 *)object; *pSwapChain = (IDirect3DSwapChain8 *)object;
} }
TRACE("(%p) returning %p\n", This, *pSwapChain); TRACE("(%p) returning %p\n", This, *pSwapChain);
@ -312,6 +314,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface, UINT
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
/* *ppTexture = NULL; */ /* *ppTexture = NULL; */
} else { } else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppTexture = (LPDIRECT3DTEXTURE8) object; *ppTexture = (LPDIRECT3DTEXTURE8) object;
} }
@ -350,6 +354,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 iface,
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
*ppVolumeTexture = NULL; *ppVolumeTexture = NULL;
} else { } else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE8) object; *ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE8) object;
} }
TRACE("(%p) returning %p\n", This , *ppVolumeTexture); TRACE("(%p) returning %p\n", This , *ppVolumeTexture);
@ -387,6 +393,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, U
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
*ppCubeTexture = NULL; *ppCubeTexture = NULL;
} else { } else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppCubeTexture = (LPDIRECT3DCUBETEXTURE8) object; *ppCubeTexture = (LPDIRECT3DCUBETEXTURE8) object;
} }
@ -452,6 +460,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(LPDIRECT3DDEVICE8 iface, U
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
*ppIndexBuffer = NULL; *ppIndexBuffer = NULL;
} else { } else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
*ppIndexBuffer = (LPDIRECT3DINDEXBUFFER8)object; *ppIndexBuffer = (LPDIRECT3DINDEXBUFFER8)object;
} }
return hrc; 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); FIXME("(%p) : Number of shaders exceeds the maximum number of possible shaders\n", This);
hrc = E_OUTOFMEMORY; hrc = E_OUTOFMEMORY;
} else { } else {
IUnknown_AddRef(iface);
object->parentDevice = iface;
This->vShaders[i] = object; This->vShaders[i] = object;
*ppShader = i + VS_HIGHESTFIXEDFXF + 1; *ppShader = i + VS_HIGHESTFIXEDFXF + 1;
} }

View File

@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 iface) {
if (ref == 0) { if (ref == 0) {
IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer); IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;

View File

@ -56,6 +56,7 @@ ULONG WINAPI IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface) {
if (ref == 0) { if (ref == 0) {
IWineD3DSwapChain_Release(This->wineD3DSwapChain); IWineD3DSwapChain_Release(This->wineD3DSwapChain);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;

View File

@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface) {
if (ref == 0) { if (ref == 0) {
IWineD3DTexture_Release(This->wineD3DTexture); IWineD3DTexture_Release(This->wineD3DTexture);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;

View File

@ -56,7 +56,6 @@ ULONG WINAPI IDirect3DVertexShader8Impl_Release(IDirect3DVertexShader8 *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;

View File

@ -57,6 +57,7 @@ ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 iface)
if (ref == 0) { if (ref == 0) {
IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture); IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;