d3d9: Don't release the parent device before destroying its children.
Releasing the device earlier may cause the underlying wineD3D device to be freed before the child object has had a chance to clean up.
This commit is contained in:
parent
c1dbeade52
commit
5d56eddb7c
|
@ -67,12 +67,16 @@ static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 ifa
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
TRACE("Releasing child %p\n", This->wineD3DCubeTexture);
|
||||
|
||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DCubeTexture_Release(This->wineD3DCubeTexture);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -65,10 +65,14 @@ static ULONG WINAPI IDirect3DIndexBuffer9Impl_Release(LPDIRECT3DINDEXBUFFER9 ifa
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DBuffer_Release(This->wineD3DIndexBuffer);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -64,10 +64,14 @@ static ULONG WINAPI IDirect3DPixelShader9Impl_Release(LPDIRECT3DPIXELSHADER9 ifa
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DPixelShader_Release(This->wineD3DPixelShader);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -82,10 +82,14 @@ static ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) {
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
if (This->parentDevice) IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DSurface_Release(This->wineD3DSurface);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
if (parentDevice) IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
|
|
@ -60,7 +60,8 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface)
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
if (This->parentDevice) IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
if (!This->isImplicit) {
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DSwapChain_Destroy(This->wineD3DSwapChain);
|
||||
|
@ -68,6 +69,9 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface)
|
|||
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
if (parentDevice) IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -67,10 +67,14 @@ static ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) {
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DTexture_Release(This->wineD3DTexture);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -66,10 +66,14 @@ static ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 i
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DBuffer_Release(This->wineD3DVertexBuffer);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -248,10 +248,14 @@ static ULONG WINAPI IDirect3DVertexDeclaration9Impl_Release(LPDIRECT3DVERTEXDECL
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
if(!This->convFVF) {
|
||||
IDirect3DVertexDeclaration9Impl_Destroy(iface);
|
||||
}
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -64,10 +64,14 @@ static ULONG WINAPI IDirect3DVertexShader9Impl_Release(LPDIRECT3DVERTEXSHADER9 i
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DVertexShader_Release(This->wineD3DVertexShader);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -66,10 +66,14 @@ static ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9
|
|||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
IDirect3DDevice9Ex_Release(parentDevice);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue