[apps/code] Fix an assertion break

Scenario: write a script, execute it in the console and open the
variable box, go back to edition and trigger autocompletion.
This commit is contained in:
Léa Saviot
2020-06-10 10:48:23 +02:00
parent d7fb5c256c
commit bee7441444

View File

@@ -52,7 +52,6 @@ bool ConsoleController::loadPythonEnvironment() {
m_pythonDelegate->initPythonWithUser(this);
MicroPython::registerScriptProvider(m_scriptStore);
m_importScriptsWhenViewAppears = m_autoImportScripts;
m_scriptStore->clearConsoleFetchInformation();
}
return true;
}
@@ -61,6 +60,10 @@ 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();
}
}