Explorar o código

gpu renderer: fixed memory leak when resizing the backbuffer

Fixes https://github.com/libsdl-org/SDL/issues/14734

(cherry picked from commit 9698e20399176a04bd01102ddaf44d73c9c8a33e)
Sam Lantinga hai 2 meses
pai
achega
5afbd85755
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/render/gpu/SDL_render_gpu.c

+ 2 - 0
src/render/gpu/SDL_render_gpu.c

@@ -940,6 +940,8 @@ static bool CreateBackbuffer(GPU_RenderData *data, Uint32 w, Uint32 h, SDL_GPUTe
     tci.sample_count = SDL_GPU_SAMPLECOUNT_1;
     tci.usage = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET | SDL_GPU_TEXTUREUSAGE_SAMPLER;
 
+    SDL_ReleaseGPUTexture(data->device, data->backbuffer.texture);
+
     data->backbuffer.texture = SDL_CreateGPUTexture(data->device, &tci);
     data->backbuffer.width = w;
     data->backbuffer.height = h;