PagesControl leak fix
This commit is contained in:
@@ -184,9 +184,7 @@ PagesControl::PagesControl() : Container(vec2(), vec2(1)){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PagesControl::add(std::string name, std::shared_ptr<UINode> panel) {
|
void PagesControl::add(std::string name, std::shared_ptr<UINode> panel) {
|
||||||
panel->visible(false);
|
|
||||||
pages[name] = Page{panel};
|
pages[name] = Page{panel};
|
||||||
Container::add(panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PagesControl::set(std::string name, bool history) {
|
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");
|
throw std::runtime_error("no page found");
|
||||||
}
|
}
|
||||||
if (current_.panel) {
|
if (current_.panel) {
|
||||||
current_.panel->visible(false);
|
Container::remove(current_.panel);
|
||||||
}
|
}
|
||||||
if (history) {
|
if (history) {
|
||||||
pageStack.push(curname_);
|
pageStack.push(curname_);
|
||||||
}
|
}
|
||||||
curname_ = name;
|
curname_ = name;
|
||||||
current_ = found->second;
|
current_ = found->second;
|
||||||
current_.panel->visible(true);
|
Container::add(current_.panel);
|
||||||
size(current_.panel->size());
|
size(current_.panel->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +224,7 @@ void PagesControl::reset() {
|
|||||||
clearHistory();
|
clearHistory();
|
||||||
if (current_.panel) {
|
if (current_.panel) {
|
||||||
curname_ = "";
|
curname_ = "";
|
||||||
current_.panel->visible(false);
|
Container::remove(current_.panel);
|
||||||
current_ = Page{nullptr};
|
current_ = Page{nullptr};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,6 @@ Panel* create_controls_panel(Engine* engine, PagesControl* pages) {
|
|||||||
|
|
||||||
for (auto& entry : Events::bindings){
|
for (auto& entry : Events::bindings){
|
||||||
string bindname = entry.first;
|
string bindname = entry.first;
|
||||||
std::cout << bindname << std::endl;
|
|
||||||
|
|
||||||
Panel* subpanel = new Panel(vec2(400, 45), vec4(5.0f), 1.0f);
|
Panel* subpanel = new Panel(vec2(400, 45), vec4(5.0f), 1.0f);
|
||||||
subpanel->color(vec4(0.0f));
|
subpanel->color(vec4(0.0f));
|
||||||
|
|||||||
Reference in New Issue
Block a user