mirror of https://github.com/encounter/SDL.git
Don't release the backbuffer on error, we didn't acquire it.
This commit is contained in:
parent
4e0fb110c8
commit
367a356132
|
@ -1462,20 +1462,17 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
|||
|
||||
result = IDirect3DSurface9_GetDesc(backBuffer, &desc);
|
||||
if (FAILED(result)) {
|
||||
IDirect3DSurface9_Release(backBuffer);
|
||||
return D3D_SetError("GetDesc()", result);
|
||||
}
|
||||
|
||||
result = IDirect3DDevice9_CreateOffscreenPlainSurface(data->device, desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &surface, NULL);
|
||||
if (FAILED(result)) {
|
||||
IDirect3DSurface9_Release(backBuffer);
|
||||
return D3D_SetError("CreateOffscreenPlainSurface()", result);
|
||||
}
|
||||
|
||||
result = IDirect3DDevice9_GetRenderTargetData(data->device, backBuffer, surface);
|
||||
if (FAILED(result)) {
|
||||
IDirect3DSurface9_Release(surface);
|
||||
IDirect3DSurface9_Release(backBuffer);
|
||||
return D3D_SetError("GetRenderTargetData()", result);
|
||||
}
|
||||
|
||||
|
@ -1487,7 +1484,6 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
|||
result = IDirect3DSurface9_LockRect(surface, &locked, &d3drect, D3DLOCK_READONLY);
|
||||
if (FAILED(result)) {
|
||||
IDirect3DSurface9_Release(surface);
|
||||
IDirect3DSurface9_Release(backBuffer);
|
||||
return D3D_SetError("LockRect()", result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue