From 2a7fb28aac3622033cc46be1dbf6f731ca25fe25 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 4 Sep 2023 17:48:56 +1000 Subject: [PATCH] Direct3D11: Fix after taking a screenshot, that attempting to resize the window would crash (Thanks 123DMWM) --- src/Graphics_D3D11.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Graphics_D3D11.c b/src/Graphics_D3D11.c index 4d9e05b9d..8d020abdc 100644 --- a/src/Graphics_D3D11.c +++ b/src/Graphics_D3D11.c @@ -1046,7 +1046,7 @@ static BitmapCol* D3D11_GetRow(struct Bitmap* bmp, int y) { } cc_result Gfx_TakeScreenshot(struct Stream* output) { - ID3D11Texture2D* tmp; + ID3D11Texture2D* tmp = NULL; struct Bitmap bmp; HRESULT hr; @@ -1080,6 +1080,7 @@ cc_result Gfx_TakeScreenshot(struct Stream* output) { finished: if (tmp) { ID3D11Texture2D_Release(tmp); } + ID3D11Resource_Release(backbuffer_res); return hr; }