fix(color): quick menu may crash after using USB SD mode (#6662)
This commit is contained in:
@@ -102,6 +102,7 @@ ViewMain::~ViewMain() { _instance = nullptr; }
|
|||||||
void ViewMain::deleteLater(bool detach, bool trash)
|
void ViewMain::deleteLater(bool detach, bool trash)
|
||||||
{
|
{
|
||||||
Layer::pop(this);
|
Layer::pop(this);
|
||||||
|
QuickMenu::shutdownQuickMenu();
|
||||||
Window::deleteLater(detach, trash);
|
Window::deleteLater(detach, trash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,6 +174,11 @@ QuickMenu* QuickMenu::openQuickMenu(std::function<void()> cancelHandler,
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QuickMenu::shutdownQuickMenu()
|
||||||
|
{
|
||||||
|
if (instance) instance->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
QuickMenu::QuickMenu() :
|
QuickMenu::QuickMenu() :
|
||||||
NavWindow(MainWindow::instance(), {0, 0, LCD_W, LCD_H})
|
NavWindow(MainWindow::instance(), {0, 0, LCD_W, LCD_H})
|
||||||
{
|
{
|
||||||
@@ -245,6 +250,7 @@ void QuickMenu::deleteLater(bool detach, bool trash)
|
|||||||
if (_deleted) return;
|
if (_deleted) return;
|
||||||
|
|
||||||
instance = nullptr;
|
instance = nullptr;
|
||||||
|
|
||||||
Window::deleteLater(detach, trash);
|
Window::deleteLater(detach, trash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ class QuickMenu : public NavWindow
|
|||||||
static QuickMenu* openQuickMenu(std::function<void()> cancelHandler,
|
static QuickMenu* openQuickMenu(std::function<void()> cancelHandler,
|
||||||
std::function<void(bool close)> selectHandler = nullptr,
|
std::function<void(bool close)> selectHandler = nullptr,
|
||||||
PageGroupBase* pageGroup = nullptr, SubMenu curPage = NONE);
|
PageGroupBase* pageGroup = nullptr, SubMenu curPage = NONE);
|
||||||
|
static void shutdownQuickMenu();
|
||||||
|
|
||||||
void onCancel() override;
|
void onCancel() override;
|
||||||
void onSelect(bool close);
|
void onSelect(bool close);
|
||||||
@@ -149,7 +150,7 @@ class QuickMenu : public NavWindow
|
|||||||
|
|
||||||
void focusMainMenu();
|
void focusMainMenu();
|
||||||
|
|
||||||
void deleteLater(bool detach, bool trash) override;
|
void deleteLater(bool detach = true, bool trash = true) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QuickSubMenu
|
class QuickSubMenu
|
||||||
|
|||||||
Reference in New Issue
Block a user