Skip to content

flush filesystem before resetting heap #1649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ bool run_code_py(safe_mode_t safe_mode) {
serial_write_compressed(translate("WARNING: Your code filename has two extensions\n"));
}
}
// Turn off the display before the heap disappears.
// Turn off the display and flush the fileystem before the heap disappears.
#if CIRCUITPY_DISPLAYIO
reset_displays();
#endif
filesystem_flush();
stop_mp();
free_memory(heap);
supervisor_move_memory();
Expand Down Expand Up @@ -375,6 +376,7 @@ int run_repl(void) {
} else {
exit_code = pyexec_friendly_repl();
}
filesystem_flush();
reset_port();
reset_board();
stop_mp();
Expand Down
6 changes: 2 additions & 4 deletions shared-module/displayio/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ void displayio_refresh_displays(void) {
if (mp_hal_is_interrupted()) {
return;
}
// Somehow reloads from the sdcard are being lost. So, cheat and reraise.
// But don't re-raise if already pending.
if (reload_requested && MP_STATE_VM(mp_pending_exception) == MP_OBJ_NULL) {
mp_raise_reload_exception();
if (reload_requested) {
// Reload is about to happen, so don't redisplay.
return;
}

Expand Down