[apps/console] Fix the script console fetch status cleaning

unloadPythonEnvironment is not called when leaving the app, only after
editing a script, so it did not do what we wanted.
This commit is contained in:
Léa Saviot
2020-06-11 14:12:50 +02:00
parent dfef134603
commit ff3b756080
2 changed files with 9 additions and 4 deletions

View File

@@ -60,10 +60,6 @@ void ConsoleController::unloadPythonEnvironment() {
if (!m_pythonDelegate->isPythonUser(nullptr)) {
m_consoleStore.startNewSession();
m_pythonDelegate->deinitPython();
/* We clean upon unloading and not upon loading, otherwise we break an
* assertion in VariableBoxController::loadFunctionsAndVariables, which
* checks that the script statuses are clean. */
m_scriptStore->clearConsoleFetchInformation();
}
}
@@ -199,6 +195,14 @@ void ConsoleController::didBecomeFirstResponder() {
}
}
void ConsoleController::willExitResponderChain(Responder * nextFirstResponder) {
ViewController::willExitResponderChain(nextFirstResponder);
/* We clean when exiting the responder chain and not when entering it,
* otherwise we break an assertion which checks that the script statuses are
* clean in VariableBoxController::loadFunctionsAndVariables. */
m_scriptStore->clearConsoleFetchInformation();
}
bool ConsoleController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
if (m_consoleStore.numberOfLines() > 0 && m_selectableTableView.selectedRow() < m_consoleStore.numberOfLines()) {