summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-02-14 12:54:34 -0800
committerScott Shawcroft <scott@tannewt.org>2019-02-19 14:50:31 -0800
commit46fd60c70398b51136a2deea84f30e867679ca53 (patch)
treed258a055ea443cb8b0b1879a2905af0eb03a3a35 /main.c
parent4e75aaecd07ea954aeba5dda59ed3d1b37bfc17d (diff)
Prevent infinite display update recursion and fix VFS mounting
Fixes #1529
Diffstat (limited to 'main.c')
-rwxr-xr-xmain.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/main.c b/main.c
index fac9864e3..68ee66d02 100755
--- a/main.c
+++ b/main.c
@@ -127,6 +127,20 @@ void stop_mp(void) {
#if CIRCUITPY_NETWORK
network_module_deinit();
#endif
+
+ #if MICROPY_VFS
+ mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table);
+
+ // Unmount all heap allocated vfs mounts.
+ while (gc_nbytes(vfs) > 0) {
+ vfs = vfs->next;
+ }
+ MP_STATE_VM(vfs_mount_table) = vfs;
+ MP_STATE_VM(vfs_cur) = vfs;
+ #endif
+
+ // Run any finalizers before we stop using the heap.
+ gc_sweep_all();
}
#define STRING_LIST(...) {__VA_ARGS__, ""}