fix(color): memory leak in setup pages (#5185)
This commit is contained in:
@@ -63,6 +63,11 @@ class TabCarouselButton : public ButtonBase
|
||||
show(isVisible());
|
||||
}
|
||||
|
||||
~TabCarouselButton()
|
||||
{
|
||||
delete pageTab;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override
|
||||
{
|
||||
@@ -89,8 +94,7 @@ class TabCarouselButton : public ButtonBase
|
||||
show(isVisible());
|
||||
if (lastIcon != getIcon()) {
|
||||
lastIcon = getIcon();
|
||||
icon->deleteLater();
|
||||
icon = new StaticIcon(this, 2, ICON_Y, lastIcon, COLOR_THEME_PRIMARY2);
|
||||
icon->setIcon(lastIcon);
|
||||
}
|
||||
ButtonBase::checkEvents();
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ class PageTab
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool isVisible() const { return true; }
|
||||
|
||||
virtual ~PageTab() = default;
|
||||
|
||||
virtual bool isVisible() const { return true; }
|
||||
|
||||
virtual void build(Window* window) = 0;
|
||||
|
||||
virtual void checkEvents() {}
|
||||
|
||||
+3
-3
@@ -167,9 +167,9 @@ void StaticIcon::setColor(LcdColorIndex color)
|
||||
|
||||
void StaticIcon::setIcon(EdgeTxIcon icon)
|
||||
{
|
||||
auto mask = getBuiltinIcon(icon);
|
||||
setSize(mask->width, mask->height);
|
||||
lv_canvas_set_buffer(lvobj, (void*)mask->data, mask->width, mask->height,
|
||||
auto newMask = getBuiltinIcon(icon);
|
||||
setSize(newMask->width, newMask->height);
|
||||
lv_canvas_set_buffer(lvobj, (void*)newMask->data, newMask->width, newMask->height,
|
||||
LV_IMG_CF_ALPHA_8BIT);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user