From 164325506e7ff650cb8906a709b3349c837dafaa Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Wed, 20 Dec 2023 13:03:13 +0100 Subject: [PATCH] cube: release framebuffers on deactivate (#2060) Currently it looks like the framebuffers are allocated on activate but never released. This causes a substantial memory leak. Fix this by adding a destructor to cube_render_instance_t that releases them. Fixes #2059 --- plugins/cube/cube.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/cube/cube.cpp b/plugins/cube/cube.cpp index 1efbe68fe..4d94e1efb 100644 --- a/plugins/cube/cube.cpp +++ b/plugins/cube/cube.cpp @@ -81,6 +81,17 @@ class wayfire_cube : public wf::per_output_plugin_instance_t, public wf::pointer } } + ~cube_render_instance_t() + { + OpenGL::render_begin(); + for (auto& buf : framebuffers) + { + buf.release(); + } + + OpenGL::render_end(); + } + void schedule_instructions( std::vector& instructions, const wf::render_target_t& target, wf::region_t& damage) override