[apps/code] Check that app can be exited before switching to DFU

This fixes the following crash: create a script which contains only
"input()". Execute it, then while in the input, plug in the calculator.
When un-plugging it, the device crashes.
This commit is contained in:
Léa Saviot
2019-01-04 16:00:28 +01:00
committed by EmilieNumworks
parent 1782326ed8
commit 58f94f5e5f
4 changed files with 31 additions and 8 deletions

View File

@@ -37,6 +37,13 @@ public:
ScriptStore m_scriptStore;
};
~App();
bool prepareForExit() override {
if (m_consoleController.inputRunLoopActive()) {
m_consoleController.terminateInputLoop();
return false;
}
return true;
}
StackViewController * stackViewController() { return &m_codeStackViewController; }
ConsoleController * consoleController() { return &m_consoleController; }