Don't release the backbuffer on error, we didn't acquire it.
authorSam Lantinga <slouken@libsdl.org>
Sun, 08 Mar 2020 18:56:07 -0700
changeset 13597178f27cd89a9
parent 13596 501950e51321
child 13598 663f2daa3e4f
Don't release the backbuffer on error, we didn't acquire it.
src/render/direct3d/SDL_render_d3d.c
     1.1 --- a/src/render/direct3d/SDL_render_d3d.c	Sat Mar 07 19:21:21 2020 -0800
     1.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Sun Mar 08 18:56:07 2020 -0700
     1.3 @@ -1462,20 +1462,17 @@
     1.4  
     1.5      result = IDirect3DSurface9_GetDesc(backBuffer, &desc);
     1.6      if (FAILED(result)) {
     1.7 -        IDirect3DSurface9_Release(backBuffer);
     1.8          return D3D_SetError("GetDesc()", result);
     1.9      }
    1.10  
    1.11      result = IDirect3DDevice9_CreateOffscreenPlainSurface(data->device, desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &surface, NULL);
    1.12      if (FAILED(result)) {
    1.13 -        IDirect3DSurface9_Release(backBuffer);
    1.14          return D3D_SetError("CreateOffscreenPlainSurface()", result);
    1.15      }
    1.16  
    1.17      result = IDirect3DDevice9_GetRenderTargetData(data->device, backBuffer, surface);
    1.18      if (FAILED(result)) {
    1.19          IDirect3DSurface9_Release(surface);
    1.20 -        IDirect3DSurface9_Release(backBuffer);
    1.21          return D3D_SetError("GetRenderTargetData()", result);
    1.22      }
    1.23  
    1.24 @@ -1487,7 +1484,6 @@
    1.25      result = IDirect3DSurface9_LockRect(surface, &locked, &d3drect, D3DLOCK_READONLY);
    1.26      if (FAILED(result)) {
    1.27          IDirect3DSurface9_Release(surface);
    1.28 -        IDirect3DSurface9_Release(backBuffer);
    1.29          return D3D_SetError("LockRect()", result);
    1.30      }
    1.31