diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-15 08:30:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 08:30:44 +0100 |
commit | af91a42b0a6f7706b2dddb88e67bd57a1b69cda6 (patch) | |
tree | 4cf2d50c51e4a3187b300346ef97378cf9b06a61 /servers/rendering | |
parent | c4779196b95928818391fcb006bae4fc5944c057 (diff) | |
parent | 71eb3f6df5d521adb87561713283e6f2f5ebc175 (diff) |
Merge pull request #57904 from V-Sekai/fix_double_free_warning
Fixes some 'Attempted to free invalid ID' warnings in mobile renderer
Diffstat (limited to 'servers/rendering')
-rw-r--r-- | servers/rendering/renderer_rd/renderer_scene_render_rd.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 2d34d2a2a0..718825d652 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -1818,11 +1818,14 @@ void RendererSceneRenderRD::_free_render_buffer_data(RenderBuffers *rb) { if (rb->blur[i].mipmaps[m].fb.is_valid()) { RD::get_singleton()->free(rb->blur[i].mipmaps[m].fb); } - if (rb->blur[i].mipmaps[m].half_fb.is_valid()) { - RD::get_singleton()->free(rb->blur[i].mipmaps[m].half_fb); - } - if (rb->blur[i].mipmaps[m].half_texture.is_valid()) { - RD::get_singleton()->free(rb->blur[i].mipmaps[m].half_texture); + // texture and framebuffer in both blur mipmaps are shared, so only free from the first one + if (i == 0) { + if (rb->blur[i].mipmaps[m].half_fb.is_valid()) { + RD::get_singleton()->free(rb->blur[i].mipmaps[m].half_fb); + } + if (rb->blur[i].mipmaps[m].half_texture.is_valid()) { + RD::get_singleton()->free(rb->blur[i].mipmaps[m].half_texture); + } } } rb->blur[i].mipmaps.clear(); |