From 3b5c039db14fefc99de26a87bc9e9fb16e4fc09f Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 20 Nov 2023 03:59:59 +0300 Subject: [PATCH] PagesControl leak fix --- src/frontend/gui/panels.cpp | 8 +++----- src/frontend/screens.cpp | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/frontend/gui/panels.cpp b/src/frontend/gui/panels.cpp index 871bc0d4..6488b6be 100644 --- a/src/frontend/gui/panels.cpp +++ b/src/frontend/gui/panels.cpp @@ -184,9 +184,7 @@ PagesControl::PagesControl() : Container(vec2(), vec2(1)){ } void PagesControl::add(std::string name, std::shared_ptr panel) { - panel->visible(false); pages[name] = Page{panel}; - Container::add(panel); } void PagesControl::set(std::string name, bool history) { @@ -195,14 +193,14 @@ void PagesControl::set(std::string name, bool history) { throw std::runtime_error("no page found"); } if (current_.panel) { - current_.panel->visible(false); + Container::remove(current_.panel); } if (history) { pageStack.push(curname_); } curname_ = name; current_ = found->second; - current_.panel->visible(true); + Container::add(current_.panel); size(current_.panel->size()); } @@ -226,7 +224,7 @@ void PagesControl::reset() { clearHistory(); if (current_.panel) { curname_ = ""; - current_.panel->visible(false); + Container::remove(current_.panel); current_ = Page{nullptr}; } } \ No newline at end of file diff --git a/src/frontend/screens.cpp b/src/frontend/screens.cpp index 09a00844..22cb092f 100644 --- a/src/frontend/screens.cpp +++ b/src/frontend/screens.cpp @@ -176,8 +176,7 @@ Panel* create_controls_panel(Engine* engine, PagesControl* pages) { for (auto& entry : Events::bindings){ string bindname = entry.first; - std::cout << bindname << std::endl; - + Panel* subpanel = new Panel(vec2(400, 45), vec4(5.0f), 1.0f); subpanel->color(vec4(0.0f)); subpanel->orientation(Orientation::horizontal);