From bafbde9f4ba00f3d4b7cee2fd5456191294ba174 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 9 Apr 2024 17:52:05 -0700 Subject: [PATCH] Clear RIDs of weight buffers when freeing to avoid double free --- .../renderer_rd/storage_rd/render_scene_buffers_rd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp index c5d74d395f2..b7934cb3dea 100644 --- a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp +++ b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp @@ -130,9 +130,10 @@ void RenderSceneBuffersRD::cleanup() { named_textures.clear(); // Clear weight_buffer / blur textures. - for (const WeightBuffers &weight_buffer : weight_buffers) { + for (WeightBuffers &weight_buffer : weight_buffers) { if (weight_buffer.weight.is_valid()) { RD::get_singleton()->free(weight_buffer.weight); + weight_buffer.weight = RID(); } } }