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) {
TRACE("Releasing child %p\n", This->wineD3DCubeTexture);
IWineD3DCubeTexture_Release(This->wineD3DCubeTexture);
IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;

View File

@ -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;
};

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;