diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 0baa5ace8ca..429b918e74a 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -677,6 +677,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 i if (hr == D3D_OK && pRenderTarget != NULL) { IWineD3DResource_GetParent((IWineD3DResource *)pRenderTarget,(IUnknown**)ppRenderTarget); + IWineD3DResource_Release((IWineD3DResource *)pRenderTarget); } else { FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n"); *ppRenderTarget = NULL; diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 9b31289e33c..8ed7b8d3045 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -403,6 +403,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9 i if (hr == D3D_OK && pRenderTarget != NULL) { IWineD3DResource_GetParent((IWineD3DResource *)pRenderTarget,(IUnknown**)ppRenderTarget); + IWineD3DResource_Release((IWineD3DResource *)pRenderTarget); } else { FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n"); *ppRenderTarget = NULL; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 4ae70a5c76e..f1287bf801c 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -6898,7 +6898,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice* iface *ppRenderTarget = This->renderTarget; TRACE("(%p) : RenderTarget %d Index returning %p\n", This, RenderTargetIndex, *ppRenderTarget); - + /* Note inc ref on returned surface */ + if(*ppRenderTarget != NULL) + IWineD3DSurface_AddRef(*ppRenderTarget); return WINED3D_OK; }