fix(color): quick menu may crash after using USB SD mode (#6662)

This commit is contained in:
philmoz
2025-10-14 20:46:29 +10:00
committed by GitHub
parent dd029bc591
commit dbffe1b193
3 changed files with 9 additions and 1 deletions
@@ -102,6 +102,7 @@ ViewMain::~ViewMain() { _instance = nullptr; }
void ViewMain::deleteLater(bool detach, bool trash)
{
Layer::pop(this);
QuickMenu::shutdownQuickMenu();
Window::deleteLater(detach, trash);
}
@@ -174,6 +174,11 @@ QuickMenu* QuickMenu::openQuickMenu(std::function<void()> cancelHandler,
return instance;
}
void QuickMenu::shutdownQuickMenu()
{
if (instance) instance->deleteLater();
}
QuickMenu::QuickMenu() :
NavWindow(MainWindow::instance(), {0, 0, LCD_W, LCD_H})
{
@@ -245,6 +250,7 @@ void QuickMenu::deleteLater(bool detach, bool trash)
if (_deleted) return;
instance = nullptr;
Window::deleteLater(detach, trash);
}
@@ -93,6 +93,7 @@ class QuickMenu : public NavWindow
static QuickMenu* openQuickMenu(std::function<void()> cancelHandler,
std::function<void(bool close)> selectHandler = nullptr,
PageGroupBase* pageGroup = nullptr, SubMenu curPage = NONE);
static void shutdownQuickMenu();
void onCancel() override;
void onSelect(bool close);
@@ -149,7 +150,7 @@ class QuickMenu : public NavWindow
void focusMainMenu();
void deleteLater(bool detach, bool trash) override;
void deleteLater(bool detach = true, bool trash = true) override;
};
class QuickSubMenu