瀏覽代碼

Made error handling more consistent in D3D12_RenderReadPixels()

Sam Lantinga 2 年之前
父節點
當前提交
90262f274a
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/render/direct3d12/SDL_render_d3d12.c

+ 2 - 2
src/render/direct3d12/SDL_render_d3d12.c

@@ -2832,8 +2832,8 @@ static int D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
                       NULL,
                       NULL,
                       (void **)&textureMemory);
                       (void **)&textureMemory);
     if (FAILED(result)) {
     if (FAILED(result)) {
-        SAFE_RELEASE(readbackBuffer);
-        return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [map staging texture]"), result);
+        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [map staging texture]"), result);
+        goto done;
     }
     }
 
 
     /* Copy the data into the desired buffer, converting pixels to the
     /* Copy the data into the desired buffer, converting pixels to the